How to delete a container created in docker

angryTom
Release: 2020-03-14 13:14:11
Original
59771 people have browsed it

How to delete a container created in docker

How to delete containers created in docker

1. First use the docker -s -a command to list all containers

# docker ps -a
 
CONTAINER ID   IMAGE   COMMAND        CREATED        STATUS        PORTS    NAMES
f2582758af13   ubuntu  "/bin/bash"    2 hours ago    Up 2 hours             first_ubuntu
6b5b5a969241   centos  "/bin/bash"    2 days ago     Exited (0) 24 hours ago   ubuntu-web
Copy after login

2. Then use the docker stop command to stop the container to be deleted

docker stop <CONTAINER ID|NAME>
Copy after login

3. Now use the following command to delete single or multiple containers.

 docker rm <CONTAINER ID|NAME> <CONTAINER ID|NAME>
Copy after login

Note: You can also use the following command to delete all stopped containers at once.

docker rm $(docker ps -a -q)
Copy after login

For more related tutorials, please pay attention to the docker tutorial column on the PHP Chinese website.

The above is the detailed content of How to delete a container created in docker. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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