by Devin Yang

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

有时在自己的环境中试了一堆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

如何更新或重建D-Laravel的FPM Image

有时,docker的Image会进行一些修正或添加更多的外挂,我们要如何来更新电脑中的image呢? 非常简单,使用docker pull [使用的image即可],如果想创建自己的image也是可行的...

docker

关於Docker的Logging Driver

Docker内建相当多的日志机制,帮我们取得在container内运行的服务信息。 这些机制(mechanisms)我们通常称为logging drivers.

docker laravel

闲聊D-Laravel的console命令

D-Laravel的console命令让我们快速的了解他运行了什么。如果使用docker-compose是怎么运行的呢? 我们来看看吧。