Back to Cron Helper
Recipedockerdevopscleanupcontainers
Clean Up Unused Docker Resources
Weekly cron job to remove unused Docker containers and images.Docker environments accumulate "dangling" images, stopped containers, and unused networks over time, consuming disk space. Running `docker system prune` weekly helps reclaim space. The `-f` flag bypasses the confirmation prompt for automation.
Cron Schedule
Command to Run
Copy and paste this command into your crontab or automation script
docker system prune -fImplementation Examples
Unix/Linux Crontab
0 0 * * 1 /path/to/script.sh
Python (with schedule library)
schedule.every().monday.do(job)
Node.js (with node-cron)
cron.schedule('0 0 * * 1', () => {
console.log('Running every Monday');
});Go (with robfig/cron)
c.AddFunc("0 0 * * 1", func() { fmt.Println("Run every Monday") })GitHub Actions Workflow
- cron: "0 0 * * 1"
Related Cron Recipes
Automate PostgreSQL Backups Daily
databasepostgresbackup
Automate MySQL Backups Daily
databasemysqlbackup
Automate MongoDB Backups Daily
databasemongodbbackup
Automate Redis RDB Snapshots
databaserediscache
PostgreSQL Vacuum Analyze
databasepostgresmaintenance