Docker 再学习 (7) 镜像层

Submitted by Lizhe on Tue, 02/26/2019 - 06:02

 

这里我只是想强调一下你无法删除 " 被其他层依赖的 层 "

 

20190226023857

 

[root@machine1 ~]# docker build -t test:latest .
Sending build context to Docker daemon   6.41MB
Step 1/3 : FROM busybox
 ---> d8233ab899d4
Step 2/3 : RUN echo "test 1"
 ---> Running in c109063fc1e4
test 1
Removing intermediate container c109063fc1e4
 ---> 61b47f9afb94
Step 3/3 : RUN echo "test 2"
 ---> Running in 163cda59f669
test 2
Removing intermediate container 163cda59f669
 ---> c04d9c1ac797
Successfully built c04d9c1ac797
Successfully tagged test:latest
[root@machine1 ~]# 
[root@machine1 ~]# docker images --all
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
test                latest              c04d9c1ac797        5 seconds ago       1.2MB
<none>              <none>              61b47f9afb94        5 seconds ago       1.2MB
busybox             latest              d8233ab899d4        11 days ago         1.2MB
nginxdemos/hello    latest              aedf47d433f1        12 months ago       16.8MB
[root@machine1 ~]# 
[root@machine1 ~]# docker rmi 61b47f9afb94
Error response from daemon: conflict: unable to delete 61b47f9afb94 (cannot be forced) - image has dependent child images
[root@machine1 ~]#