Skip to content

Incorrect digest returned? #54

Description

@jurre

Currently the digest is fetched from the Docker registry manifest
endpoint
with the
application/vnd.docker.distribution.manifest.v2+json Media Type:

dt=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:library/python:pull" | jq -r .access_token)
curl curl --get -v https://registry.hub.docker.com:443/v2/library/python/manifests/slim --header "Authorization: Bearer $dt" --header "Accept: application/vnd.docker.distribution.manifest.v2+json"
< HTTP/1.1 200 OK
< Content-Length: 1370
< Content-Type: application/vnd.docker.distribution.manifest.v2+json
< Docker-Content-Digest: sha256:af2d64e6de9f891bd5958a498bd2394389143749b3c57ffcc8c2aec054b28ad5

However, the digest that is returned in the header here, is actually
that of the first platform that's listed.

When we install that latest image, we see the digest should actually be:

docker images --digests | grep python
python slim sha256:50328b4efe5ff8ef8bb2e62e088a4cefeace39062c483c04987f5820e7cf73b1

When using the
application/vnd.docker.distribution.manifest.list.v2+json media type:

dt=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:library/python:pull" | jq -r .access_token)
curl curl --get -v https://registry.hub.docker.com:443/v2/library/python/manifests/slim --header "Authorization: Bearer $dt" --header "Accept: application/vnd.docker.distribution.manifest.list.v2+json"

< HTTP/1.1 200 OK
< Content-Length: 1862
< Content-Type: application/vnd.docker.distribution.manifest.list.v2+json
< Docker-Content-Digest: sha256:50328b4efe5ff8ef8bb2e62e088a4cefeace39062c483c04987f5820e7cf73b1

We get the expected digest, and when inspecting the body, we can see
that we previously got the digest for amd64:

{
  "manifests": [
    {
      "digest": "sha256:af2d64e6de9f891bd5958a498bd2394389143749b3c57ffcc8c2aec054b28ad5",
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "platform": {
        "architecture": "amd64",
        "os": "linux"
      },
      "size": 1370
    },

Should we be using the manifest-list.v2 media type to fetch the digest?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions