From 6ab941c71886bd941e59be2c3e4648274e8c03af Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 28 Dec 2023 23:59:05 +0100 Subject: [PATCH] Removed warning for dangling volumes --- .../files/health-docker-volumes.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/roles/health-docker-volumes/files/health-docker-volumes.sh b/roles/health-docker-volumes/files/health-docker-volumes.sh index 0cf4fab2..c165e870 100644 --- a/roles/health-docker-volumes/files/health-docker-volumes.sh +++ b/roles/health-docker-volumes/files/health-docker-volumes.sh @@ -22,7 +22,8 @@ for volume in $anonymous_volumes; do continue fi - status=1 + ((status++)) + container_ids=$(docker ps -aq --filter volume=$volume) if [ -z "$container_ids" ]; then echo "Volume $volume is not used by any running containers." @@ -41,12 +42,4 @@ for volume in $anonymous_volumes; do done done -# Additional warning for dangling volumes -dangling_volumes=$(docker volume ls -f dangling=true --format "{{.Name}}") -if [ -n "$dangling_volumes" ]; then - status=2 - echo "The following dangling volumes were found:" - echo "$dangling_volumes" -fi - exit $status