Docker 刪除鏡和在鏡像倉庫拉去鏡像

第一步:1. 查詢鏡像

python@ubuntu:~/Desktop$ sudo docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              4ab4c602aa5e        2 weeks ago         1.84 kB

第二步:查詢容器

python@ubuntu:~/Desktop$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
6e21b4251fe3        hello-world         "/hello"            56 minutes ago      Exited (0) 56 minutes ago                       silly_nobel

第三步:3. 先刪除容器

python@ubuntu:~/Desktop$ sudo docker rm 6e21b4251fe3
6e21b4251fe3
python@ubuntu:~/Desktop$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

第四步:刪除鏡像

python@ubuntu:~/Desktop$ sudo docker image rm hello-world
Untagged: hello-world:latest
Untagged: hello-world@sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788
Deleted: sha256:4ab4c602aa5eed5528a6620ff18a1dc4faef0e1ab3a5eddeddb410714478c67f
Deleted: sha256:428c97da766c4c13b19088a471de6b622b038f3ae8efa10ec5a37d6d31a2df0b

拉取鏡像

python@ubuntu:~/Desktop$ sudo docker image pull library/hello-world
Using default tag: latest
latest: Pulling from library/hello-world
d1725b59e92d: Pull complete 
Digest: sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788
Status: Downloaded newer image for hello-world:latest

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章