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,git

用docker-compose快速建立私有的git服務

如何快速建立一個開箱即用的Gogs環境呢? 本文介紹採用docker-compose.yml快速建立gogs環境。

docker,laravel,nfs

Docker在macOS上的NFS

D-laravel的nfs模式,在這篇文章您可以了解到,如何在macOS使用NFS+Docker。

docker

關於GCE上FPM image如何變更owner

CCC網站升級php 7.2.0囉,有Docker的環境,輕鬆搞定php升級, 在Linux上Image的變更還是有些注意事項您應該了解。 如果您跟我一樣透過docker將D-Laravel安裝於Linux的系統上,當您變更不同的image時, 或許您可能會碰到,疑!怎麼composer沒有權限寫入資料夾的錯誤。 directory is not writable