How to remove docker containers when out of disk space?

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?

  • Answer:

    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.

Marcello de Sales at Stack Overflow Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.