Skip to content

Instantly share code, notes, and snippets.

@dmbeta
Created May 17, 2025 18:49
Show Gist options
  • Save dmbeta/111ac88a0301cfe2dbe1a2507f8f9fd1 to your computer and use it in GitHub Desktop.
Save dmbeta/111ac88a0301cfe2dbe1a2507f8f9fd1 to your computer and use it in GitHub Desktop.
#!/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
@dmbeta
Copy link
Author

dmbeta commented May 17, 2025

Run with curl -sSL https://gist.githubusercontent.com/dmbeta/111ac88a0301cfe2dbe1a2507f8f9fd1/raw/0c065f50ce707057aaaf2b18177b5bcfe408ebf4/docker-prune.sh | bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment