镜像的缓存特性 - 每天5分钟玩转 Docker 容器技术(14)
上一节我们学习了镜像的分层结构,今天讨论镜像的缓存特性。 Docker 会缓存已有镜像的镜像层,构建新镜像时,如果某镜像层已经存在,就直接使用,无需重新创建。 举例说明。在前面的 Dockerfile 中添加一点新内容,往镜像中复制一个文件: root@ubuntu:~# ls ① Dockerfile testfile root@ubuntu:~# root@ubuntu:~# docker build -t ubuntu-with-vi-dockerfile-2 . Sending build context to Docker daemon 32.77 kB Step 1 : FROM ubuntu ---> f753707788c5 Step 2 : RUN apt-get update && apt-get install -y vim ---> Using cache ② ---> 35ca89798937 Step 3 : COPY testfile / ③ ---> 8d02784a78f4 Removi...
