Skip to content

Instantly share code, notes, and snippets.

@ntamvl
Last active February 21, 2024 11:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ntamvl/03acc631628bbaae95b584708235d7b3 to your computer and use it in GitHub Desktop.
Save ntamvl/03acc631628bbaae95b584708235d7b3 to your computer and use it in GitHub Desktop.
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