docker删除镜像流程

想要删除docker中的镜像主要可分为以下几步:1  停止在运行的容器 2 删除镜像的容器 3.删除镜像

//查看docker下的容器
[root@yuslave3 ~]# docker ps -a
CONTAINER ID        IMAGE                        COMMAND             CREATED             STATUS                          PORTS               NAMES
3ab84313034c        docker.io/gitlab/gitlab-ce   "/assets/wrapper"   2 days ago          Restarting (1) 45 seconds ago                       gitlab
//若容器在运行,则需要先停止在运行的容器
[root@yuslave3 ~]# docker stop 3ab84313034c
3ab84313034c
//拿到docker容器的id,删除docker容器
[root@yuslave3 ~]# docker rm 3ab84313034c
3ab84313034c
//查看docker容器列表
[root@yuslave3 ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
//查看镜像
[root@yuslave3 ~]# docker images
REPOSITORY                   TAG                 IMAGE ID            CREATED             SIZE
docker.io/gitlab/gitlab-ce   latest              eb85f9e7e4b4        8 days ago          1.84 GB
//找到要删除的镜像id,删除镜像
[root@yuslave3 ~]# docker rmi eb85f9e7e4b4
Untagged: docker.io/gitlab/gitlab-ce:latest
Untagged: docker.io/gitlab/gitlab-ce@sha256:cb473b6df91ca6657ae3e1135224aa09b0507a3511383cc704b67f81956e9e0d
Deleted: sha256:eb85f9e7e4b40f2b2802ab23814d5af0fe8ad4de39653902da4ab8dd220c5e80
Deleted: sha256:7339bf08a0e095abf54b584e0592e4da3163dfb1ed95ce733549ab1134e76135
Deleted: sha256:44255bf02ffbea52de59feb6f2e7e9a929cb0beb12b69fdab0027dbf6619633b
Deleted: sha256:70ffcfc992f7630702f41fccb5f318dc35e4b5c27af7a79cf93b26547759de76
Deleted: sha256:2c0b24a5ce71f22b5a09ae0e8ecb410880b6947e5209ebcfcef7ed357d2d10d4
Deleted: sha256:4f56280fff400ad65cd2d5febff1f42d8d9801abd824b79bbef722420707f820
Deleted: sha256:98c2a9d758840a41ac709fc46b911ae7b393bc8fc7c93d341910e20e79e12acb
Deleted: sha256:9f6a9daab62ba80b0c15987c10e0284a54ed6e4215b3c12b8608b2e4aac3b3e2
Deleted: sha256:a8b8e5eedb5fd2d3fb35ed4773d6b0cdf1d4e4caddccd5d55b5d39c6ce5a4cda
Deleted: sha256:30f14160ebdacef8ca253a54e9c86aa993f4666c24efa4dc27e02e76b9661bc7
Deleted: sha256:f749b9b0fb213e9897417a985aaa9753d41bff474e1d0c0d1d266c4512eaf031
//再次查看docker镜像列表
[root@yuslave3 ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

 

你可能感兴趣的:(docker学习与实践)