Home > Article > Operation and Maintenance > In which directory is the image compiled by docker placed?
The image is placed in the docker root directory. The content of the image layer is generally in the aufs path of the Docker directory, the specific address is "/var/lib/docker/aufs/"; for each image layer, a corresponding json file will be saved, the path is "/var/lib/docker /graph".
The operating environment of this tutorial: Ubuntu 14.04 system, docker-1.7.1 version, Dell G3 computer.
There will always be the first time when you understand the Docker image. Since then, of course, there has been growth. The author’s own understanding You might as well share the process with everyone:
First contact with Docker: I believe that many enthusiasts will have the same understanding as me: Docker image represents a Contents of the file system of the container;
Initial contact with the joint file system: The concept of the joint file system made me aware of the technology of image hierarchical management, each layer of image All are part of the container file system content.
Study the relationship between images and containers: Containers are a dynamic environment, and the files in each layer of images are static content. However, ENV and VOLUME in Dockerfile , CMD and other contents ultimately need to be implemented into the running environment of the container, and these contents cannot be directly located in the file system contents contained in each layer of the image. So how should Docker manage this part of the content?
In addition, in the third step above, there is another situation that I believe everyone is familiar with. The size of many mirror layers is 0, and there is no file content inside the mirror layer. What's going on?
You can recall that in "Docker Image Detailed Discussion (1): Container File System", about the generation of empty images, it mentioned "updating the json file of the image". In fact, the foreshadowing laid in the previous article hints at the truth - Docker image content consists of the image layer file content and the image json file. Regardless of static content or dynamic information, Docker updates it in the json file.
The json file of each Docker image layer plays a very important role. Its main functions are as follows:
Record the information related to the Docker image Content related to container dynamic information
Record the real difference relationship between parent and child Docker images
Make up for the lack of integrity of the Docker image content and dynamic content
The json file of the Docker image can be considered as the metadata information of the image, and its importance is self-evident. .
Theoretical analysis of Docker image content seems a bit confusing, regardless of the Docker image layer file or json The document is a bit boring to read. If you can get a glimpse of the real environment in Docker, I believe it will be of great help to your understanding of mirroring technology.
Let’s go straight to the topic and start with the storage of Docker images to see where the contents of these image layer files and the image json files are stored. (The experimental environment shown below: the host operating system is Ubuntu 14.04, the Docker version is 1.7.1, the graphdriver type is aufs, and only contains one image of ubuntu:14.04.)
View the image Layer composition
We can view ubuntu:14.04 through the command docker history ubuntu:14.04, the results are as follows:
The picture shows that the ubuntu:14.04 image has 4 image layers.
Image layer file content storage
The contents of the Docker image layer are generally under the aufs path of the Docker root directory. is /var/lib/docker/aufs/, the details are as follows:
The picture shows the contents of the 4 image layers of the image ubuntu:14.04, and each image layer The first-level directory situation within. An additional note is that there is nothing in the image layer d2a0ecffe6fa.
Mirror json file storage
For each image layer, Docker will save a corresponding json file. The json file The storage path is /var/lib/docker/graph, ubuntu:14.04. The json file storage paths of all image layers are shown as follows:
In addition to the json file, you can also see that each image layer also contains a layersize file, which mainly records the total size of the file contents inside the image layer. Now that we have talked about the mirror json file, in order to pave the way for the following, the json file of the ubuntu:14.04 hollow mirror layer d2a0ecffe6fa is posted below:
docker video tutorial"
The above is the detailed content of In which directory is the image compiled by docker placed?. For more information, please follow other related articles on the PHP Chinese website!