How to stop and remove all Docker containers

  • 16 March 2018
  • ADM

 

How to stop and remove all Docker containers - images/logos/docker.jpg

 

Sometimes when you are working with Docker is easy to get lost in containers and a fresh start is needed or simple you run out of space. Here is how to stop and remove all containers.

To stop all the containers:

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

To remove all the containers:

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