简体   繁体   中英

Docker - var/lib/docker/layers folder content

What does exactly var/lib/docker/layers contains? I found, that:

Infomation about docker layer

I have checked out and in it is a file for every container, which contains several characters or empty. I haven't found any logic in content.

If you are referring to /var/lib/docker/aufs/layers . This contains the layers for the images created on your system with docker pull or build .

ex: I have the following image built on my host.

$ docker images 
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
devbox              1.0                 d17a89ba7b49        46 hours ago        717.5 MB

Now find the layers associated with image:

ls /var/lib/docker/aufs/layers -lh | grep d17a89ba7b49
-rw-r--r-- 1 root root 2.6K Oct  7 14:43 d17a89ba7b49d534c0e9f4d24ddf70f490f16b2548e874961a7ef42a93376f2d


cat /var/lib/docker/aufs/layers/d17a89ba7b49d534c0e9f4d24ddf70f490f16b2548e874961a7ef42a93376f2d

    86976168b2da85a2804f08f32529a70ef3c55659943466f7231e10aab57529bb
    664221c455e9e412e95d5505da4139e568043decb87e13cd15198038f554e978
    629e4b1afddb681969bf233b339311a856f3d14f0afb8c13ad70ea0fb7aaccf3
    a1a2a7a152e0002824558fb411b9214715de752cae906cc83732555c65899292
    1e36bd2a92516294f2607dfe49c68a600ca5ca9ca0ab64d65655afd9bac03432
    e52b2f57801a3c8a3de5e6431de32aa965c1ddd2aad56480acdf0929e10cb38f
    412b8dd613c482c70e55267ddb4f98e095be0e263d5aead8950857867b59c97e
    67e97b8f862b6b7fea1aff647161f6885aa3d207451a60c69737152b70742901
    773120c89b700d15afab5a3104ecb26edb4cdb72ecdd6424d5a0680a3f205c02
    ...
    ...

Note: there are other commands like docker history with are better understandable output.

Note: Its best to understand the layers using tools available rather than jumping into the FS. If the built images are pushed on to docker hub , you can get a pictorial view the image layers along with finer details on each layers, including the command that was run to create the layer and the size of the layer added etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM