Docker 常用指令集

把一些常用的Docker指令集做個備份

列出目前的Contaner

1
docker ps

停止執行中的Container

1
docker stop [CONTAINER ID]

刪除Container

1
docker rm [CONTAINER ID]

列出Image

1
docker images

刪除Image

1
docker rmi [IMAGE ID]

刪除所有的Container for linux

1
2
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)

刪除所有的Container for Windows command
RemoveAllDockerContainer.bat

1
2
3
4
@echo off
FOR /f "tokens=*" %%i IN ('docker ps -aq') DO docker stop %%i
FOR /f "tokens=*" %%i IN ('docker ps -aq') DO docker rm %%i
FOR /f "tokens=*" %%i IN ('docker images --format "{{.ID}}"') DO docker rmi %%i