Search code examples
cachingdockerchecksum

What checksum does Docker use for caching COPY?


I am trying to debug a Docker cache issue and I want to check if the cache should match.

Step 7 : COPY myfile /home/me/myfile
 ---> daa0799b47df

What does the above ID represent? It doesn't seem to be part of a md5 or sha1 checksum. Can I run a command to check this?


Solution

  • It is random bytes, hex encoded. This is the short form returned by https://github.com/moby/moby/blob/0eefae8e0db0c3c567e8807f09434a0da3fc1261/utils/utils.go#L171 and generated by https://github.com/moby/moby/blob/0eefae8e0db0c3c567e8807f09434a0da3fc1261/utils/utils.go#L180. It is not a checksum and once again is random. It is simply used to identify images and containers.