openstack-ansible-os_zun/templates/zun-docker-cleanup.j2
2021-12-02 10:10:56 +00:00

16 lines
496 B
Django/Jinja

#!/bin/bash
# If the disabled file is present, don't allow the script
# to run unless it is forced.
if [ -e "/var/tmp/zun-docker-cleanup.disabled" ] && [ "$1" != "--force" ]; then
echo "Timed cleanup of Docker data is disabled"
echo "To force a cleanup, re-run this script with '--force'"
exit 0
fi
# Clear dangling images from Docker
docker image prune -f
# Clear old images from Zun cache directory
find {{ zun_system_home_folder }}/images -amin +1440 -type f -exec rm -fv {} \;