Home >Operation and Maintenance >Docker >How to delete a container in docker
View running containers
(Recommended learning: docker tutorial)
docker ps
View all containers
docker ps -a
Enter the container, where the string is the container ID:
docker exec -it d27bd3008ad9 /bin/bash
1. Deactivate all running containers:
docker stop $(docker ps -q)
2. Delete all containers:
docker rm $(docker ps -aq)
3. One command to deactivate and delete the container:
docker stop $(docker ps -q) & docker rm $(docker ps -aq)
The above is the detailed content of How to delete a container in docker. For more information, please follow other related articles on the PHP Chinese website!