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

需要登入才可留言!

類似的文章


polymer,docker

D-Laravel預設支援index.html了

D-Laravel的nginx環境設定預設支援index.html了,簡單說 現在除了,可以用D-Laravel跑Laravel的Project,也可以拿來跑其他的Project。 目前Apple的WebKit對Service-Workers已經是in preview了....

docker

聞聊我的網路的演變史

聞聊我的網路的演變史。 我的GCP,每月要$46.35美元,目前免費試用餘額還剩$111.05美元, $300元差不多快被我花光了,差不多要搬回自管理的主機了。

docker

用樹莓派安裝Docker及docker-compose

本文簡單介紹我們如何在Raspberry Pi上安裝docker及docker-compose。