停止并删除所有Docker容器 [英] Stop and remove all docker containers

查看:103
本文介绍了停止并删除所有Docker容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用Docker容器创建干净的最佳方法是什么?很多时候,我觉得从头开始比较容易,但是我有一堆容器,我不确定它们的状态是什么,然后当我运行 docker rm 时不会让我,因为Docker容器可能仍在使用中。

What is the best way to create a clean slate with your Docker containers? Lots of times I feel it is easier to start from scratch, but I have a bunch of containers that I am not sure what their states are, then when I run docker rm it won't let me because the docker container could still be in use.

推荐答案

停止所有容器

docker stop $(docker ps -a -q)

删除所有容器

docker rm $(docker ps -a -q)

此处

这篇关于停止并删除所有Docker容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆