Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the differences among layer, diff and mnt directories of aufs storage drivers in Docker

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you the "Docker aufs storage driver layer, diff, mnt directory what are the differences", the content is easy to understand, well-organized, hope to help you solve your doubts, the following let the editor lead you to study and learn "what are the differences between layer, diff, and mnt directories of aufs storage drivers in Docker".

Docker basic Information

First, query the back-end storage used by Docker. Using the command docker info, focus on the parts related to Storage Driver.

$docker info...Server Version: 1.12.6Storage Driver: aufs Root Dir: / var/lib/docker/aufs Backing Filesystem: extfs Dirs: 84 Dirperm1 Supported: true...

As you can see from above, the version of Docker is 1.12.6. The back-end storage used is the aufs file system and its root directory is / var/lib/docker/aufs.

Docker image information lists all Docker images $docker images REPOSITORY TAG IMAGE ID CREATED SIZEubuntu latest 0ef2e08ed3fa 6 weeks ago 130 MB

As you can see, there is only one mirror in the current environment, and its IMAGE ID is 0ef2e08ed3fa.

Docker Image details

Use the docker inspect [docker IMAGE ID] command to query the details of the image. The .RootFS.Layers section shows that the image contains a total of five layers, but since Docker v1.10, the sub-image ID is not the same as the file name or directory name in the root directory.

Layer directory

The image ID in layer corresponds to a file, and the content of the file is the list of ancestor images of the image.

$ls-l / var/lib/docker/aufs/layerstotal 16KRWFY RFY-1 root root 65 Apr 10 20:38 0970941dc3951f04f21bbbbac1180b300006a22a970d4a04c269ac9de34e1bd47MYRWMY RFT-1 root root 130 Apr 10 20:38 312d24c768f671045eab1415a2ffc67dadea4e59b88c37bd66a2f5b0fad9frwafafe-1 root root-195 Apr 10 20:38 8317eee16b68bc1620b59e38208d903e9f9f8f06e2bf9c29089e373feb491wff1f02fba1f7c409f4f347f1f1479f1f

Since there is only one Docker image in the environment, according to the size of the files in this directory, it can be concluded that the largest file corresponds to the uppermost child image in the Docker image (because it has the most parent images).

$cat / var/lib/docker/aufs/layers/eef7e551d5f8eaf2a7f1c54effef0f28a97978be3e79a2a7dd30f1962071c9818317eee16b68c1620b59e38208d903e9f8f06e2b5f9cc29089eae373bfe491ce312d24c768f671045eabed1415a2ffc67dadea4e59b88c37bd2366a2f5b0fad90970941dc3951f04f21bbbac1180b300006a22a970d4a04c269ac9de34e1bd47d2adfba71f24c5c409df4abef47f3caf4861f37b822f9ea3ed945f61e9aef77fdiff directory

The diff directory contains five subdirectories, corresponding to the five subimages of the Docker image. Each directory contains the real files and directories stored in the sub-image.

$ls-l / var/lib/docker/aufs/diff/eef7e551d5f8eaf2a7f1c54effef0f28a97978be3e79a2a7dd30f1962071c981total 4drwxr-xr-x 3 root root 4096 Feb 28 03:41 run

In the submirror layer of the above example, there is only one directory for run.

Mnt directory

The mnt directory also contains five subdirectories, corresponding to the five subimages of the Docker image.

When you use this image to create a container, the corresponding layer of the container and the init layer of the container will be added in this layer.

The running container is mapped under / var/lib/docker/aufs/mnt/, which is a mount point that AUFS gives to the container and its underlying layer. If the container is not running, there is still this directory, but it is an empty directory, because AUFS is only mapped when the container is running. In addition, there is a directory of-init, which represents the init layer. In the version above Docker 1.10, the directory name also does not correspond to the container ID.

The writable layer of the container is stored in the directory / var/lib/docker/aufs/diff/,. Even if the container stops, the corresponding directory of the container still exists. Only when the container is deleted will the corresponding directory be deleted.

These are all the contents of this article entitled "what are the differences between layer, diff and mnt directories of aufs storage drivers in Docker? thank you for reading!" I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report