Docker : How are intermediate containers formed

半世苍凉 提交于 2019-11-30 06:33:34

Yes, Docker images are layered. When you build a new image, Docker does this for each instruction (RUN, COPY etc.) in your Dockerfile:

  1. create a temporary container from the previous image layer (or the base FROM image for the first command;
  2. run the Dockerfile instruction in the temporary "intermediate" container;
  3. save the temporary container as a new image layer.

The final image layer is tagged with whatever you name the image - this will be clear if you run docker history raghavendar/hands-on:2.0, you'll see each layer and an abbreviation of the instruction that created it.

Your specific queries:

1) 532 is a temporary container created from image ID b17, which is your FROM image, ubuntu:14.04.

2) ea6 is the image layer created as the output of the instruction, i.e. from saving intermediate container 532.

3) yes. Docker calls this the Union File System and it's the main reason why images are so efficient.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!