Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the command to delete the docker container

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

What is the command to delete the docker container? You can use the "docker rm container id" command to delete a container in a terminated state; to delete a running container, you need to add the-f parameter.

Command to delete all containers

Docker rm $(docker ps-a-Q) / / remove

Command to stop all containers

Docker stop $(docker ps-a-Q) / / stop

We can also batch delete containers that have been stopped in the Docker

1. Show all containers, filter out the containers with Exited status, and remove the ID of these containers.

Sudo docker ps-a | grep Exited | awk'{print $1}'

2. Query all containers, filter out containers with Exited status, list container ID, and delete these containers.

Sudo docker rm `docker ps-a | grep Exited | awk'{print $1}'`

Or delete the container in Exited state according to its status

Sudo docker rm $(sudo docker ps-qf status=exited)

What is the command to delete the docker container is shared here, I hope that the above content can have a certain reference value, you can learn to apply. If you like this article, you might as well share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report