February 12, 2025

How to Correctly Delete all Docker Containers, Images, and Volumes

In this Docker container tutorial, we explain how to delete all Docker containers, images, and volumes. We also explain how to list all images and containers and how to prune all Docker containers, images, and volumes. The YouTube tutorial is given below.

To list all Docker containers, type this

docker ps -a

To list all Docker images

docker images -a

To see the folder where everything is stored:

docker info | grep "Docker Root Dir"

Remember, first, you need to erase all containers before erasing all images. To delete all containers including its volumes use

docker rm -vf $(docker ps -aq)

To delete all images

docker rmi -f $(docker images -aq)

Finally, to make sure that everything is deleted, that is to remove all unused containers, volumes, networks and images, type this:

docker system prune -a --volumes