'How can I remove all containers running docker [duplicate]
I want running containers to be stopped and removed.
PS C:\Users\Bayram Eren> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8d8299ddb6bf nginx "/docker-entrypoint.…" 8 minutes ago Up 8 minutes 80/tcp con1
554971502a96 nginx:latest "/docker-entrypoint.…" 17 minutes ago Up 17 minutes 80/tcp goofy_goldberg
PS C:\Users\Bayram Eren>
Docker container prune -f
Total reclaimed space: 0B returns result
Why is this happening
Solution 1:[1]
You have to stop your containers before removing them:
docker stop 8d8299ddb6bf
docker stop 554971502a96
Or you can stop all running containers in one command
docker stop $(docker ps -q -f status=running)
Then you can call
docker container prune -f
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
