by Devin Yang

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

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

需要登入才可留言!

类似文章


linux,docker,wifi

用docker创建WPA2/EAP企业用Radius验证伺服器,后端使用mysql数据库

AP提供了WPA2/EAP功能,但不会用吗? 本文介绍我如何透过docker的ubuntu:21.04 image,极速创建Radius伺服器, 与Wifi的WPA2/EAP等相关运用。

docker

D-Laravel上.env及docker-compsoe小教室

本文介绍,当我们使用D-Laravel的.env加载多个yml档时,为何docker-compose ps官方命令无法列出所有使用中的服务。 但在D-Laravel上的./console ps确能正常显示,那官方的docker-compose命令因如何使用才能有相同的效果呢?

fastapi,phpenv,docker

我如何用phpenv创建fastapi运行环境

虽然phpenv主要用於运行PHP Laravel的环境,但不代表他不能跑其他语言或其他容器。本文介绍,我如何让phpenv跑python的fastapi环境,当然这只是一个概念,目前为止,我已经让PHP api跑HAProxy了,并且自动申请及更新免费证书,现在就让他来跑Python的fastapi吧。phpenv没有什么限制,限制的是您的想像力😆