diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2021-01-04 07:47:56 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2021-01-04 07:47:56 +0000 |
commit | 6374b03133449ad31e9285ffd3bb78acca1efee9 (patch) | |
tree | 3469e39d25beca9221ae4f92f267bff615da41ce /tcwg-cleanup-stale-containers.sh | |
parent | 49acfb8a50661b74f64352914b48b259be6bef38 (diff) |
Docker image pull: And one more fix
... to ignore "docker rmi" failures on used images.
Change-Id: I69fd40c45fe5f0b36e4b833097c2ac4e5a57b984
Diffstat (limited to 'tcwg-cleanup-stale-containers.sh')
-rwxr-xr-x | tcwg-cleanup-stale-containers.sh | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tcwg-cleanup-stale-containers.sh b/tcwg-cleanup-stale-containers.sh index 84f4a5ea..8cd201e2 100755 --- a/tcwg-cleanup-stale-containers.sh +++ b/tcwg-cleanup-stale-containers.sh @@ -186,11 +186,12 @@ if $cleanup_images; then image_stamp="$stamp_dir/$(echo "$image" | tr "/:" "_")" remove_if_not_used_since=$(($(date +%s) - 3*24*60*60)) # Use negative comparison to handle non-existent stamp files. - if ! [ "$(stat -c %Z "$image_stamp.use")" \ + if ! [ "$(stat -c %Z "$image_stamp.use" 2>/dev/null)" \ -gt $remove_if_not_used_since ] 2>/dev/null; then # Untag the image. Use $image_id to handle previously-untagged # images and other cases when we have no repo or tag reference. - docker rmi -f "$image_id" + docker rmi -f "$image_id" 2>/dev/null \ + || echo "NOTE: Cannot remove $image_tuple" fi done # Prune untagged images. |