Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Docker: Remove All Images and Containers

Docker: Remove All Images and Containers

Starting over in this case means wiping clean my Docker images and containers, just to make sure there are no conflicts or duplicates. The following commands delete all containers and images:

Delete every Docker containers Must be run first because images are attached to containers

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

Delete every Docker image

docker rmi -f $(docker images -q)

Of course you don't want to do this if you're using Docker across multiple projects -- you'll find yourself in a world of hurt if you break your other images and containers.

There you have it -- a clean Docker slate in one pass!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.