Useful Docker Commands

Written on December 2, 2016 by YorkshireKev

These are a bunch of docker commands that I find useful for keeping things tidy.

Remove all orphaned images. These are the images tagged as <none>.

docker images -q --filter "dangling=true" | xargs docker rmi

Delete/remove all stopped containers. Note that -v option; it will also delete any persistent volumes that belong to the stopped containers.

docker ps -aq --filter "status=exited" | xargs docker rm -v && docker ps -aq --filter "status=created"