Useful Docker commands

docker wallpaper

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.

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

One thought on “Useful Docker commands

Leave a Reply

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