fix(scripts): handle docker cleanup when no containers are running (#977)

The docker-cleanup.sh script failed when no containers were running because
grep -v returned exit code 1 on empty input, causing the script to abort
due to set -euo pipefail.

Add || true to the volume detection pipeline so the script succeeds when
there are no running containers (in_use_volumes will be empty, which is
the correct behavior).

Signed-off-by: Derek Carr <decarr@redhat.com>
This commit is contained in:
Derek Carr
2026-04-26 23:02:40 -07:00
committed by GitHub
parent bb5bdb483e
commit f8fb382146
+1 -1
View File
@@ -217,7 +217,7 @@ info "Removing unused volumes..."
# Identify volumes in use by running containers
in_use_volumes=$(ce ps -q 2>/dev/null \
| xargs -r ce inspect --format '{{range .Mounts}}{{.Name}} {{end}}' 2>/dev/null \
| tr ' ' '\n' | sort -u | grep -v '^$')
| tr ' ' '\n' | sort -u | grep -v '^$' || true)
unused_volumes=()
while read -r vol; do