by Devin Yang

建立于: 7年前 ( 更新: 7年前 )

有时在自己的环境中试了一堆container或是images,如何全部移掉系统中所有的images及container 呢?
这些命令提供给大家参考: 

请注意,您确实了解docker中container及images是什么东西。
请勿随意运行如下的命令,在上线中的主机上:


stop all containers: 停止所有的container

docker kill $(docker ps -q)

remove all containers: 移除所有的container
docker rm $(docker ps -qa)

remove all docker images: 移除所有的docker images
docker rmi $(docker images -q)


注: 关於docker stop及docker kill差异,我们可透过如下命令查看说明:
docker help stop
The main process inside the container will receive SIGTERM, and after a grace period, SIGKILL.

docker help kill
The main process inside the container will be sent SIGKILL, or any signal specified with option --signal.

Tags: docker

Devin Yang

文章内容无法一一说明,如果您有什么不了解处,欢印提问哦:)

No Comment

Post your comment

需要登入才可留言!

类似文章


docker

ubuntu上安装docker-compose

简单介绍我如何在ubuntu上安装docker-compose. 还满容易的。

docker,laravel

如何使用多个YAML档,运行多个docker的container服务

这个影片介绍如何用docker-compose命令,指定多个YAML结构语言设置档,来创建容器的运行,并且介绍在D-Laravel的使用环境中,我们如何透过使用.env的方式,简化docker-compose的启动命令。

docker

如何简单的用Docker创建internet命令行的测速进程呢?

如何简单的用Docker创建internet命令行的测速进程呢? 这里我们使用python的进程speedtest-cli 会用Docker主要的用例,例如我想要在我的NAS内进行测速, 虽然我的NAS内有python,但没有pip命令,这时用Docker感觉上安全很多, 当然前题您的NAS需能跑Docker:)。 或者,我在MacOS的环境,我不想安装speedtest-cli到我的MacOS中。 这时用Docker简单的自建简单的运行环境还满不错的。