Created
May 17, 2025 18:49
-
-
Save dmbeta/111ac88a0301cfe2dbe1a2507f8f9fd1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# Check if the file exists | |
if [ ! -f /etc/cron.daily/docker-prune ]; then | |
# Write the command to the file | |
echo '#!/bin/bash' > /etc/cron.daily/docker-prune | |
echo 'docker system prune -af --filter "until=$((30*24))h"' >> /etc/cron.daily/docker-prune | |
# Make the file executable | |
chmod +x /etc/cron.daily/docker-prune | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run with
curl -sSL https://gist.githubusercontent.com/dmbeta/111ac88a0301cfe2dbe1a2507f8f9fd1/raw/0c065f50ce707057aaaf2b18177b5bcfe408ebf4/docker-prune.sh | bash