Reputation: 8195
On Linux I can delete all of the stopped containers with this handy one-liner:
$ docker rm $(docker ps -a -q)
It's documented here: Remove all stopped containers
But what's the equivalent syntax for Windows?
Upvotes: 3
Views: 2039
Reputation: 28997
You can use docker container prune
to remove all stopped containers (or docker system prune
to cleanup other unused resources, such as unused networks, unused images, etc.
More information can be found in the reference documentation for this command
Upvotes: 9
Reputation: 60
In CMD terminal you can run:
FOR /f "tokens=*" %i IN ('docker ps -aq') DO docker rm %i
In Powershell terminal you can run:
docker ps -aq | % { docker rm $_ }
In Git Bash terminal you can run:
docker rm $(docker ps -aq)
Upvotes: 0