title: What is the relationship between a docker image ID and the IDs in the manifests?
body: <p>I am trying to understand the connection between the image ID as reported by <code>docker images</code> (or <code>docker inspect</code>) and the actual layers or images in the registry or manifest (using v2).</p>
  
  <p>I run docker images, I get (abbreviated and changed to protect the not-so-innocent):</p>
  
  <pre><code>REPOSITORY                                             TAG                 IMAGE ID
  my.local.registry/some/image      latest              abcdefg
  </code></pre>
  
  <p>If I pull the manifest for the above image using the API, I get one that contains <code>fsLayers</code>, not one of which matches the (full) ID for the image. I get that, since the image is the <em>sum</em> of the layers. </p>
  
  <p>However, if I pull that image elsewhere, I get the same ID. If I update the image, push and pull it, the new version has a new ID.</p>
  
  <p>I thought it might be the hash of the manifest. However, (a) pulling the manifest via the API does not return the hash of the manifest in the JSON, and (b) looking in the registry directory itself, the sha256 of the given manifest in <code>/var/lib/registry/v2/repositories/some/image/_manifests/tags/latest/current/link</code> (or those in <code>index/sha256/</code>) give the correct link for the manifest that was downloaded, but does not match the image ID.</p>
  
  <p>I had assumed the image ID matches the blob, but perhaps I am in error? </p>