From fb6ad1030f5bbd89c1ab4baf0cd0b79a28d36e50 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Wed, 28 Feb 2024 00:35:30 +0000 Subject: [PATCH] Only remove images if we have any. --- run.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/run.sh b/run.sh index b733664..509658b 100755 --- a/run.sh +++ b/run.sh @@ -141,7 +141,11 @@ while true; do docker system prune --all --force fi if [[ "${WEBAPP_IMAGE_PRUNE:-true}" == "true" ]]; then - docker image rm -f $(docker image ls --quiet --filter 'reference=laconic-webapp') + OLD_IMAGES="$(docker image ls --quiet --filter 'reference=laconic-webapp')" + if [[ -n "$OLD_IMAGES" ]]; then + echo "Pruning images: $OLD_IMAGES" + docker image rm -f $OLD_IMAGES + fi fi sleep ${CHECK_INTERVAL:-15} done