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