Docker Community Forums

Share and learn in the Docker community.

Inspecting the filesystem of each layer of an image

Hey there! I’m trying to get the changes on the filesystem of each layer of my image. Right now I’m using the images/{name}/get API endpoint to retrieve the filesystem changes of each layer, but I’m having a hard time identifying where the layer id’s on the files come from - they are not the id of the layer image nor the RootFS layer id’s retrieved using $- docker history {name}.

As an example, for the image with id a0f52ce222a0cb210ebf23d86f9bdb5bf6e2cbccb81adc5d8dcb98d153a9f2ab :

Files on the tar retrieved using images/a0f52ce22/get:

a0f52ce222a0cb210ebf23d86f9bdb5bf6e2cbccb81adc5d8dcb98d153a9f2ab.json
a15b4865596e87509ef876ada1a5dd5f82040fc469856bc3f32d7d6b1ed9297f/VERSION
a15b4865596e87509ef876ada1a5dd5f82040fc469856bc3f32d7d6b1ed9297f/json
a15b4865596e87509ef876ada1a5dd5f82040fc469856bc3f32d7d6b1ed9297f/layer.tar
fa4b5b9a709a811f38e10545ee1eddc93c20d7159733783fb699ef1a4d047a6f/VERSION
fa4b5b9a709a811f38e10545ee1eddc93c20d7159733783fb699ef1a4d047a6f/json
fa4b5b9a709a811f38e10545ee1eddc93c20d7159733783fb699ef1a4d047a6f/layer.tar
manifest.json

$- docker history a0f52ce22:

IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
a0f52ce222a0        2 hours ago         /bin/sh -c #(nop) ADD file:ac3e6df808a8cadb0…   311B
a187dde48cd2        13 days ago         /bin/sh -c #(nop)  CMD ["/bin/sh"]              0B
<missing>           13 days ago         /bin/sh -c #(nop) ADD file:0c4555f363c2672e3…   5.6MB

As you can see, none of these id’s match each other except for the target image, meaning that I can’t match the layer to the actual filesystem layer generated during the build. The json files included in the tar don’t help either. Is there any way to match the layers inside the tar to the intermediate layers generated during the build?