Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does docker clean the container

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report