Only remove images if we have any.

This commit is contained in:
Thomas E Lackey 2024-02-28 00:35:30 +00:00
parent 14646f42b2
commit fb6ad1030f

6
run.sh
View File

@ -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