简体   繁体   中英

Remove docker images and containers that are taking disk space

I've been using Docker for a while... I usually the command "docker run" to run containers. Today, I had the problem of saving data to disk on a database:

No space left on device

According to various documentation online, the solution is to use the following command:

docker stop $(docker ps -a -q) docker rm $(docker ps -a -q)

However, it fails in a lot of entries... Is there a proper way to clean up containers and images?

The latest version of Docker supports the following command:

$ docker rmi $(docker images -q --filter "dangling=true")

The command will properly remove the images... This is described at https://www.calazan.com/docker-cleanup-commands/ , and some comments from http://jimhoskins.com/2013/07/27/remove-untagged-docker-images.html .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM