summaryrefslogtreecommitdiff
path: root/tcwg-cleanup-stale-containers.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2016-11-17 05:48:04 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2016-11-17 05:48:04 +0000
commitd027afcf4a0415b8b2868c5429745b3418a525c7 (patch)
tree1f890bbba8381a3b41ae11c696ae21bdf7c32f19 /tcwg-cleanup-stale-containers.sh
parent4b0dfcb91e0d55c900df142a608afc2bd34bb42e (diff)
tcwg-cleanup-stale-containers: Improve detection of dangling images
Change-Id: I68a2df464a9fe1a9563ad2e5b0df068890146082
Diffstat (limited to 'tcwg-cleanup-stale-containers.sh')
-rwxr-xr-xtcwg-cleanup-stale-containers.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/tcwg-cleanup-stale-containers.sh b/tcwg-cleanup-stale-containers.sh
index 1e3aaa54..97fd3f9c 100755
--- a/tcwg-cleanup-stale-containers.sh
+++ b/tcwg-cleanup-stale-containers.sh
@@ -75,12 +75,12 @@ if [ x"$(docker volume ls -q -f dangling=true)" != x"" ]; then
fi
fi
-if [ x"$(docker images | grep "^<none>" | awk '{print $3}')" != x"" ]; then
+if [ x"$(docker images -q -f dangling=true)" != x"" ]; then
echo "Removing untagged images"
echo "Increasing exit code by 4 to indicate untagged images"
status="$(($status+4))"
if ! $dry_run; then
- docker images | grep "^<none>" | awk '{print $3}' | xargs -i@ docker rmi @ | cat
+ docker images -q -f dangling=true | xargs -i@ docker rmi @ | cat
echo "xargs docker rmi exit status: ${PIPESTATUS[3]}"
else
echo "DRY_RUN: NOT REMOVING UNTAGGED IMAGES"