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

需要登入才可留言!

類似的文章


openai,flax,docker

用容器跑OpenAI官方教學的Python(Flax)

如果您登入了openai的網站,可在此處看到官方的教學說明https://beta.openai.com/docs/quickstart/build-your-applicationAPI的KEY的申請,就在這頁的下方就有按鈕了+ Create new secret key本篇教您用Docker跑官方OpenAI執行環境。

wordpress, d-laravel, docker, docker-compose

如何用D-Laravel安裝Wordpress

約8分鐘的教學影片,介紹在D-Laravel上安裝Wordpress. D-Laravel是一個docker-compose的Laravel框架開發環境,但不代表他不能拿來裝別的東西。 這個影片,介紹使用D-Laravel安裝非Laravel的PHP專案, 您可以學到D-Laravel上的相關指令用法: ./create --host用法, docker-compose up -d及 ./console mysql用法, D-Laravel v1.0.0版後的資料庫連線設定方式。

docker,container,laravel

在Nas上手動更新D-Laravel的使用者id全記錄

本文全記錄,紹我如何更新我家Nas上的fpm image的uid。 本文章中,您應該會學會查詢容器id及commit容器等相關概念。