Docker Community Forums

Share and learn in the Docker community.

Layer IDs shown as <missing> in history


(Mikehaertl) #1

I’ve created an automated build from one of my projects and pulled it to my local machine. I now want to inspect the history and especially compare the IDs to my manually generated images. Unfortunately i only see <missing> instead of the hash IDs. Why is that?

$ docker history cb003797
IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
cb0037973c9e        12 minutes ago      /bin/sh -c composer install --prefer-dist --n   37.18 MB            
<missing>           12 minutes ago      /bin/sh -c #(nop) COPY file:923c2a81ca77026de   37.71 kB            
<missing>           12 minutes ago      /bin/sh -c #(nop) COPY file:ac11867f64e4fdd4e   856 B               
<missing>           12 minutes ago      /bin/sh -c #(nop) WORKDIR /var/www/html         0 B                 
<missing>           12 minutes ago      /bin/sh -c #(nop) COPY file:c9bf664e3b00557ec   170 B
...

(Mikehaertl) #2

Ok, I’ve found this note in the documentation:

Note: Under the content addressable storage model introduced with Docker 1.10, image history data is no longer stored in a config file with each image layer. It is now stored as a string of text in a single config file that relates to the overall image. This can result in some image layers showing as “missing” in the output of the docker history command. This is normal behaviour and can be ignored.

But I’m still confused about the new image IDs. Shouldn’t the image ID be the same, if the content is the same? In my case it is not. I’ve done an automated build and a local manual build from the same source. It ends up with different image IDs. How can I make sure, that identical layers are reused?


(Mikehaertl) #3

This gets quite disturbing. I’ve now created a very simple Dockerfile for a test:

FROM php:5.6.10-apache

MAINTAINER haertl.mike@...

ENV PATH $PATH:/root/.composer/vendor/bin

COPY composer.json /var/www/html/
COPY composer.lock /var/www/html/

This should generate only a couple of very small layers on top of php:5.6.10-apache. I’ve run an automated build and pulled the final image. I definitely already had php:5.6.10-apache available locally. Still it downloaded ~100MB!! I have no idea what the content of those downloaded layers was.

So how can I find out the hashed layer IDs for an image and whether they are reused? Why is this hidden now?