by Devin Yang

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

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

D-Laravel创建SQLServer环境

如何创建D-Laravel的SQLSever环境

docker,laravel

用Docker创建Lravel开发环境超简单

Laravel 5.5系统环境您准备好了吗? laravel/framework 5.5.x-dev requires php >=7.0 -> your PHP version (5.6.30) does not satisfy that requirement. 这篇文章描述如何使用Docker创建Laravel的开发环境。 有了简单到爆炸的D-Laravel简易bash, 不要在说我无法创建Laravel的开发环境了。

docker

Docker防毒攻略

最近刚看玩延禧攻略,就想来介绍个MacOS扫毒攻略。 这篇文章,教大家用如何用Docker搞定MacOS扫毒。 简单介绍,我们如何透过docker使用防毒软体扫毒。 这里假定目前我的目录是在我的家目录中,所以${PWD}就是目前的所在目录,会被挂载到container内的scan数据夹。 所以,使用clamscan -r /scan/,时就能扫描所有的挡案罗,加上-r的参数会使用递归的方式一层一层的进入子目录扫描。