Last active
April 15, 2021 17:59
-
-
Save olkitu/b60c8236686e863ad52e5302855363da to your computer and use it in GitHub Desktop.
Gitlab CI Docker Prune
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run this daily to cleanup unused images and networks | |
# chmod +x /etc/cron.daily/docker-clean.sh | |
# Create new log file | |
touch /var/log/docker-clean.log | |
# Delete all unused images and volumes | |
/usr/bin/docker system prune --volumes -a -f >> /var/log/docker-clean.log | |
# Delete all unused networks | |
/usr/bin/docker network prune -f >> /var/log/docker-clean.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment