Erfan Tahriri Erfan Tahriri - 2 months ago 16x
Linux Question

How to remove all Docker containers

I want to remove all of my docker containers at once. I tried to use $ docker rm [container_id] to do so, but it removed only one container, not all.

Is there any way to remove all docker containers using one single line of code?


Remove containers based on status:

docker rm -v $(docker ps --filter status=exited -q)


  • The "-v" option that will delete any volumes associated with the containers.

To clean out all containers on my development machine:

docker kill $(docker ps -qa) && docker rm -v $(docker ps -qa)