Remove Docker images no more used

Posted by ZedTuX 0n R00t on November 29, 2014

How to go from the following:


easily ?

Just run the following commands (and ignore the warnings and errors …):

$ docker ps -a -q --filter "status=exited" | xargs docker rm
$ docker rmi `docker images --filter "dangling=true" | awk '{ print $3 }' | grep -v IMAGE`

The magic here is the --filter flag of docker which allows us to filter the existing images and select only the one which are in status exited (so no running).