Docker 常用指令

Docker 常用指令

Docker 常用指令整理

docker ps

列出所有正在執行的 container


docker ps  --all

列出過去曾經新增的 container


docker run

= docker create + docker start


docker start -a + container id

重新開啟過去開過的 container。


docker system prune

刪除下列:(通常會在docker使用後幾週,想要清除一些空間時用)。
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all dangling build cache


docker logs  + container id

取得 logs ,不是重跑一次,比較省資源,通常在 debug 或設定時使用。


docker stop + container id

會等回應,10秒後若沒有回應會自動執行 docker kill.


docker kill + container id

直接停止該 id 的 container。

Thanks a lot

評論