How to delete a container in docker

王林
Release: 2020-07-01 17:33:26
forward
7105 people have browsed it

How to delete a container in docker

View running containers

(Recommended learning: docker tutorial)

docker ps
Copy after login

View all containers

docker ps -a
Copy after login

Enter the container, where the string is the container ID:

docker exec -it d27bd3008ad9 /bin/bash
Copy after login

1. Deactivate all running containers:

docker stop $(docker ps -q)
Copy after login

2. Delete all containers:

docker rm $(docker ps -aq)
Copy after login

3. One command to deactivate and delete the container:

docker stop $(docker ps -q) & docker rm $(docker ps -aq)
Copy after login

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template