How does docker clean the container
Docker how to clean the container, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
After using the container for a while, we need to clean up some "garbage" so that docker takes up less space. For programs with a lot of output logs, Logs is something to be reckoned with. In particular, the development server, frequent deployment, will lead to a lot of unused Images also take up space.
The sudden increase in the space occupied by Container is generally mainly due to the fact that there are too many files generated by some exceptions and too much logs is written in the container.
List useless volumes
Docker volume ls-qf dangling=true
Clean up useless volumes, containers, mirrors
Docker volume rm $(docker volume ls-qf dangling=true) docker rmi $(docker images | grep'^'| awk'{print $3}') docker images-- no-trunc | grep'| awk'{print $3}'\ | xargs docker rmidocker system prunedocker volume prunedocker rm $(docker ps-Q) docker rmi $(docker images-Q)
Executing the following command completely clears all containers.
Docker system prune-a-f
Or:
Docker rm-f $(docker ps-qa) rm-rf / var/lib/etcd / var/lib/cni / var/run/calicorm-rf / etc/kubernetes/SSL / etc/kubernetes/.tmp/rm-rf / opt/cni
Or:
Docker rm-f `docker ps-aq & & rm-rf / var/lib/etcd / var/lib/cni / var/run/calico / etc/kubernetes/ssl / etc/kubernetes/.tmp/ / opt/ CNI `have you mastered how docker cleans containers? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!