Advertisement
docker wallpaper
Advertisement

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

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

Advertisement

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
Advertisement

By Enrico

My greatest passion is technology. I am interested in multiple fields and I have a lot of experience in software design and development. I started professional development when I was 6 years. Today I am a strong full-stack .NET developer (C#, Xamarin, Azure)

One thought on “Useful Docker commands”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.