summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xstart-container-docker.sh2
-rwxr-xr-xtcwg-cleanup-stale-containers.sh5
2 files changed, 4 insertions, 3 deletions
diff --git a/start-container-docker.sh b/start-container-docker.sh
index f306c34e..179a5ac4 100755
--- a/start-container-docker.sh
+++ b/start-container-docker.sh
@@ -237,7 +237,7 @@ pull_image=false
# that any change to master docker images will be deployed within a day.
pull_if_older_than=$(($(date +%s) - 1*24*60*60))
# Use negative comparison to handle non-existent stamp files.
-if ! [ "$(stat -c %Z "$image_stamp.pull")" \
+if ! [ "$(stat -c %Z "$image_stamp.pull" 2>/dev/null)" \
-gt $pull_if_older_than ] 2>/dev/null; then
pull_image=true
fi
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.