Project

Profile

Help

Issue #3293

closed

docker engine 1.13.1 sends manifest list Accept header

Added by mihai.ibanescu@gmail.com over 6 years ago. Updated about 5 years ago.

Status:
CLOSED - NOTABUG
Priority:
Normal
Assignee:
-
Start date:
Due date:
Estimated time:
Severity:
3. High
Version - Docker:
Platform Release:
Target Release - Docker:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

As a user using Docker Engine 1.13.1 from Fedora 27, I want to pull an image served by crane. The only image in the repo is a v2 schema 2 image.

It appears that it will no longer send an Accept: header of application/vnd.docker.distribution.manifest.v2+json as a result of a docker pull.

It will instead issue a application/vnd.docker.distribution.manifest.list.v2+json

The way I am reading https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md#backward-compatibility it looks like, if the client sends a request for a manifest list (which seems to always be the case with newer docker engines), but there is no manifest list matching the identifier, a matching manifest (if it does exist) should be returned.

Before I submit a PR, here is what I did to make the code work:

diff --git a/crane/views/v2.py b/crane/views/v2.py
index 8aab15a..5d42595 100644
--- a/crane/views/v2.py
+++ b/crane/views/v2.py
@@ -96,7 +96,8 @@ def name_redirect(relative_path):
                 # one repo manifest list and image manifest with the same tag
                 else:
                     path_component = os.path.join(manifest, '1', identifier)
-            elif schema2_mediatype in accept_headers and identifier in schema2_data:
+            elif (manifest_list_mediatype in accept_headers or
+                  schema2_mediatype in accept_headers) and identifier in schema2_data:
                 path_component = os.path.join(manifest, '2', identifier)
             else:
                 path_component = os.path.join(manifest, '1', identifier)

I would like, if possible, for someone to confirm that crane as shipped in 2.15 is indeed not working with the specified version of the Docker engine, when a version2 schema2 image exists in the repo.

Also available in: Atom PDF