When using Docker, or when using Docker as a container run-time for Kubernetes, over time, some unused data may build up on the system that runs Docker, for example on worker nodes of a Kubernetes cluster. This unused data may include images that were once downloaded locally, but are no longer used, for example, when a deployment to Kubernetes was once done, but later removed. This unused data may become quite a lot of data, and file systems may over time fill up because of this.
There is a simple Docker command that will prune all the unused data, and this command is:
If you don't want to worry about pruning any unused Docker data, then schedule a cron job on your system as user root, like this:# docker system prune -a
0 */12 * * * * docker system prune -a -f