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 to implement docker garbage collection

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

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "how to achieve docker garbage collection". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1 find the docker folder

Find /-name docker

2 enumerate the folder size

Du-h-time-max-depth=1 .df-hdf-TH

3 Docker takes up disk space to view

Docker system df

4 remove all containers that are not running (you can also use docker-gc)

Docker rm $(docker ps-a | grep Exited | awk'{print $1}') docker rm $(docker ps-qf status=exited)

5 delete all untagged images

Docker rmi $(docker images-Q-f dangling=true)

6 remove all useless volume

Docker volume rm $(docker volume ls-qf dangling=true)

7 clean disks, delete closed containers, useless data volumes and networks

Docker system prune

8 stop all running containers

Docker stop $(docker ps-Q)

9 stop all containers

Docker stop $(docker ps-a-Q)

10 remove all containers

Docker rm $(docker ps-aq)

11 Delete all mirrors

This is the end of docker rmi $(docker images-Q) "how to implement docker garbage Collection". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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