Home  >  Article  >  Operation and Maintenance  >  How to delete a container in docker

How to delete a container in docker

王林
王林forward
2020-07-01 17:33:267097browse

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!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete
Previous article:Docker common commandsNext article:Docker common commands