Skip to main content

Docker Commands.....

Stop all container

docker container stop $(docker container ls -aq)

Remove all container

docker container rm $(docker container ls -aq)

Remove all images

docker image prune -a

Purging All Unused or Dangling Images, Containers, Volumes, and Networks

docker system prune

To additionally remove any stopped containers and all unused images (not just dangling images), add the -a flag to the command:

docker system prune -a

To see docker images list

docker images -a

Removing Docker Images

docker rmi Image Image

Remove all images in one command

docker rmi $(docker images -a -q)

Remove a container upon exit

docker run --rm image_name

List of all exited container 

docker ps -a -f status=exited

To all exited container 

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

To stop all container

docker stop $(docker ps -a -q)

To remove unused all images

docker rmi $(docker images -f dangling=true)

Delete all volumes using the following command:

docker volume rm $(docker volume ls -q)