What's the difference between a Docker image's Image ID and its Digest? : <p>This has been surprisingly confusing for me. I thought Docker's Image ID is its SHA256 hash. However, apparently the result from <code>docker image ls --digests</code> (listed under the column header <code>DIGEST</code>) is different from the <code>IMAGE ID</code> of that image.</p>

<p>For example</p>

<pre><code>docker image ls --digests alpine
REPOSITORY          TAG                 DIGEST                                                                    IMAGE ID            CREATED             SIZE
alpine              latest              sha256:769fddc7cc2f0a1c35abb2f91432e8beecf83916c421420e6a6da9f8975464b6   055936d39205        2 weeks ago         5.53MB
</code></pre>

<p>while </p>

<pre><code>docker image ls --no-trunc
REPOSITORY                                             TAG                 IMAGE ID                                                                  CREATED             SIZE
...
alpine                                                 latest              sha256:055936d3920576da37aa9bc460d70c5f212028bda1c08c0879aedf03d7a66ea1   2 weeks ago         5.53MB
</code></pre>

<p>Clearly <code>sha256:055936d3920576da37aa9bc460d70c5f212028bda1c08c0879aedf03d7a66ea1</code> (IMAGE ID) and <code>sha256:769fddc7cc2f0a1c35abb2f91432e8beecf83916c421420e6a6da9f8975464b6</code> (DIGEST) are not the same value. But why? What's the purpose of having two different <code>sha256</code> hashes of the same image. How are they calculated, respectively?</p>

<p>I was confused by this when reading the book <em>Docker Deep Dive</em>, and I haven't been able to find a clear answer either in the book or online.</p>
