The article says to regularly run prune, how regularly? Currently I run the following once per day from cron:
docker system prune -a -f
docker volume prune -a -fThe article says to regularly run prune, how regularly? Currently I run the following once per day from cron:
docker system prune -a -f
docker volume prune -a -f
This would depend entirely on how much churn your system is doing on containers/volumes/images. Once a day sounds really often for most situations.
"Regularly" = when you're running out of space because of a bunch of built up old stuff.
From the docs, you can just run `docker system prune -a --volumes`
Ref: https://docs.docker.com/reference/cli/docker/system/prune/
Personally, I'd recommend the pointed 'docker {container,image,volume} prune' commands for scheduling granularity/control. At least, filtering as you've also shown.
The 'system' context captures networks; much to my dismay, this has been a problem for no fewer than three employers. It's painfully common for things to expect the networks to persist. They don't really consume resources, so I see no reason to invite the systematic heartburn.
When? When there's disk pressure. Maybe some longer term (weekly, monthly?) to keep a lid on things. The image cache provides a benefit, no sense fighting it. At our rate, daily pruning means I might lose hours (through a week) repeatedly pulling the same images.
Monitor your disks to see if they grow full, and have an idea what your storage baseline should be. Storage in /var/lib/docker/overlay2 can also leak, even if you prune regularly.