有時在自己的環境中試了一堆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
.
No Comment
Post your comment