Full Stack LAMP - MEAN Developer, Python developer. Certified Azure Developer. Freelance programmer/consultant/trainer.

How To Stop and Remove All Docker Images, Containers, and Volumes

In this guide, I will show you simple tips to stop and remove containers, docker images, and values.

List all Docker Images

docker images -q

Removing Docker Image or images

// to remove one specific image
docker rm image1
// to remove two (more) specific images, just mention list
docker rm image1 image2

Removing All Docker Image

docker rmi $(docker images -q)

Remove a container(s)

// to remove one specific container
docker rm container1
// to remove two (more) specific container, just mention list
docker rm container1 container2

Remove a container and its volume

docker rm -v container_name

List all containers (only IDs)

docker ps -aq

Stop all running containers

docker stop $(docker ps -aq)

Remove all containers

docker rm $(docker ps -aq)

Remove all exited containers

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

Remove containers using more than one filter

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

clean all in one command

docker system prune

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments