This commit is contained in:
Joey Hafner 2022-08-18 10:58:35 -07:00
parent 65270cea45
commit 8938a19c1d

View File

@ -4,13 +4,12 @@ for CONTAINER_ID in $(docker ps -aq) # get list of all loaded containers (runnin
do do
CONTAINER_NAME=$(docker ps -aq --filter "id=$CONTAINER_ID" --format '{{.Names}}') # get the container's name CONTAINER_NAME=$(docker ps -aq --filter "id=$CONTAINER_ID" --format '{{.Names}}') # get the container's name
CONTAINER_MOUNTS=$(docker inspect --format '{{range .Mounts}}{{println .Source}}{{end}}' $CONTAINER_ID) # print the container's volume mounts CONTAINER_MOUNTS=$(docker inspect --format '{{range .Mounts}}{{println .Source}}{{end}}' $CONTAINER_ID) # print the container's volume mounts
echo "======== CHECKING $CONTAINER_NAME ========" #echo "======== CHECKING $CONTAINER_NAME ========"
echo "$CONTAINER_MOUNTS" | grep -q /mnt/nas echo "$CONTAINER_MOUNTS" | grep -q /mnt/nas
MATCH=$? MATCH=$?
echo "$MATCH"
if [ $MATCH == 0 ]; then if [ $MATCH == 0 ]; then
echo "NAS DEPENDENT" echo "$CONTAINER_NAME IS NAS DEPENDENT"
else else
echo "NOT NAS DEPENDENT" echo "$CONTAINER_NAME IS NOT NAS DEPENDENT"
fi fi
done done