Debug School

Nilesh Kumar
Nilesh Kumar

Posted on

What is a Docker image.

A docker image consists of layers of filesystem. Base and most bulkiest in size is usually the root file system.
Lets understand with the image httpd.
docker pull httpd and then do
docker inspect httpd
Run following max debt command
du -h --max-dept=1
This command will give you the list of layers that is present for this docker image, it will look something like below
`

0 ./l
87M ./cbc6425cda491b250b098dc0c74af0235bea8e6ce4b67cb3bbc115ea821b6eb6
8.0K ./29566a9c43b68426cb16d9a20876debb439290dc2d685095518ccf2050ba66f5
5.2M ./75f57747a9aafda7b1b02c02656e60f295d3f9217cf2798c69fc86b9712ed893
59M ./d97fef69b83d86abd40b6e61f84e1b94324cc72370d2e1ed2e5aa65f0196bc83
12K ./6294788f871fe9be307c7cfb77544879ec3c422b2db88bfae3cf9265cceceef0
151M .
`
All these layers when merged together forms a httpd image. Merging happens when we create a container out of this image.
When we starts the container all these layers are merged, if there is conflict in any file then top layer will take precedence. The merged image will have two important directory, diff and merge.
Diff will hold all the changes that we are doing in image, for e.g. lets say you want to create a file in this docer image in /opt/example.txt. This example.txt will go into diff folder of container merged image. and using this it will go and create an container.

Top comments (0)