镜像的Layer
在docker docs里面有一句话:
We’ve already seen that Docker images are read-only templates from which Docker containers are launched. Each image consists of a series of layers. Docker makes use of union file systems to combine these layers into a single image. Union file systems allow files and directories of separate file systems, known as branches, to be transparently overlaid, forming a single coherent file system.
对于docker的images,是由一层层的layer组成的,然后通过联合挂载的方式挂载成一个文件系统。
假设你有以下的dockerfile:
FROM ubuntuENV http_proxy 10.144.xx.xx:8080ENTRYPOINT ["/usr/bin/bash"]
首先你选择了基础镜像ubuntu,这个镜像有很多层。可以从/val/lib/docker下面找到该镜像的信息和每一层的信息。
然后ENV是设置了一个环境变量,这句命令同样会产生一个layer,再然后就是需要执行的命令,同样会产生一个layer。如果你更改了某一层的信息,那么从这层之后所有的层都需要重新build。