Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Some Docker commands

STOP ALL CONTAINERS

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

REMOVE ALL CONTAINERS

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

REMOVE ALL IMAGES

$ docker rmi $(docker images -a -q)

REMOVE ALL EXITED CONTAINERS

$ docker rm $(docker ps -q -f status=exited)

REMOVE ALL IMAGES

$ docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
$ docker rmi $(docker images -f "dangling=true" -q)

REMOVE ALL IMAGES

$ docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs sudo docker rm

REMOVE ALL VOLUMES (not used)

$ docker volume prune

REMOVE ALL NETWORK (not used)

$ docker network prune
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment