summaryrefslogtreecommitdiff
path: root/tcwg-cleanup-stale-containers.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2020-04-10 15:59:11 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2020-04-10 15:59:11 +0000
commitf8246eeb91dec4e3bb052b94528dc646e3f1a3aa (patch)
tree1afa9a94c156e2e2ed90db103234db514767c892 /tcwg-cleanup-stale-containers.sh
parent7c6e7a67c62c8336352c2e062573747740fc4c0e (diff)
tcwg-cleanup-stale-containers.sh: Improve docker image cleanup
Use Docker's internal command to cleanup images. Change-Id: Ibb4605761d3c638fcf18d061763c1e2594c7b890
Diffstat (limited to 'tcwg-cleanup-stale-containers.sh')
-rwxr-xr-xtcwg-cleanup-stale-containers.sh12
1 files changed, 2 insertions, 10 deletions
diff --git a/tcwg-cleanup-stale-containers.sh b/tcwg-cleanup-stale-containers.sh
index 98599c49..97d8e1ba 100755
--- a/tcwg-cleanup-stale-containers.sh
+++ b/tcwg-cleanup-stale-containers.sh
@@ -173,17 +173,9 @@ else
fi
if $cleanup_images; then
- for image in $($DOCKER images -q -f dangling=true); do
- # Try to remove $image. The command will fail if the image is
- # used by something.
- $DOCKER rmi $image &
- res=0; wait $! || res=$?
- if [ $res = 0 ]; then
- echo "Removed image $image"
- fi
- done
+ docker image prune -a -f
else
- echo "DRY_RUN: NOT REMOVING UNTAGGED IMAGES"
+ echo "DRY_RUN: NOT REMOVING UNUSED IMAGES"
fi
# This is a workaround for https://issues.jenkins-ci.org/browse/JENKINS-49097.