docker contain stop rm

@Docker:~$ docker stop web2 #先停止
web2
@Docker:~$ docker run --name webCCH -d -p 12345:80 nginx:v2
2e6dc3aaa501f6030fba97f9ca9XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@Docker:~$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                   NAMES
2e6dc3aaa501        nginx:v2            "nginx -g 'daemon ..."   20 seconds ago      Up 19 seconds       0.0.0.0:12345->80/tcp   webCCH
@Docker:~$ docker rm web2 #再刪除
web2
@Docker:~$ docker rm webCCH #直接刪,會噴錯
Error response from daemon: You cannot remove a running container 2e6dc3aaa501f6030fba97f9ca9XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. Stop the container before attempting removal or force remove
@Docker:~$ docker stop webCCH
webCCH
@Docker:~$ docker rm webCCH
webCCH
@Docker:~$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
@Docker:~$

留言

熱門文章