docker clear all containers code example

Example 1: remove all images docker

docker rmi $(docker images -a -q)

Example 2: docker remove all containers

docker rm $(docker ps -a -q)

Example 3: docker delete all containers

docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)

Example 4: how to clean up all docker containers

docker container list -qa | xargs docker container stop && docker container prune

Example 5: docker remove container

//Check if the container is running
docker ps -a

//stop the container
docker stop 

//remove the container
docker rm 

Tags:

Misc Example