Project

Profile

Help

Issue #3293

docker engine 1.13.1 sends manifest list Accept header

Added by mihai.ibanescu@gmail.com almost 4 years ago. Updated over 2 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.

History

#1 Updated by mihai.ibanescu@gmail.com almost 4 years ago

  • Description updated (diff)

#2 Updated by ipanova@redhat.com almost 4 years ago

docker engine 1.13 should send with each request 3 headers : manifest list, schema2 and schema1.

To confirm that the code did not change i'd need to look into the docker code, in addition i did not spot anything related to the headers in the release notes https://docs.docker.com/cs-engine/1.13/release-notes/

I will try to pull with 1.13 and confirm or refute the issue.

#3 Updated by ipanova@redhat.com almost 4 years ago

I have installed docker1.13, i do see all 3 headers as expected from the docker client, in the repo i have just one image manifest schema2

[Thu Jan 18 15:08:32.378270 2018] [wsgi:error] [pid 10524] [INFO] crane.views.v2: HEADERS
[Thu Jan 18 15:08:32.378335 2018] [wsgi:error] [pid 10524] [INFO] crane.views.v2: application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.docker.distribution.manifest.v1+prettyjws, application
/json, application/vnd.docker.distribution.manifest.v2+json

less /var/log/httpd/access_log| tail -2
::1 - - [18/Jan/2018:16:23:10 +0100] "GET /v2/ HTTP/1.1" 200 2 "-" "docker/1.13.1 go/go1.7.5 git-commit/092cba3 kernel/4.11.12-100.fc24.x86_64 os/linux arch/amd64 UpstreamClient(Docker-Client/1.13.1 \\(linux\\))"
::1 - - [18/Jan/2018:16:23:10 +0100] "GET /v2/skopeo1/manifests/myname HTTP/1.1" 302 357 "-" "docker/1.13.1 go/go1.7.5 git-commit/092cba3 kernel/4.11.12-100.fc24.x86_64 os/linux arch/amd64 UpstreamClient(Docker-Client/1.13.1 \\(linux\\))"

[ipanova@ina pulp_development]$ docker pull localhost:1234/skopeo1:myname
myname: Pulling from skopeo1
Digest: sha256:b25c0292200c1a9c29a86d367f7e9d05d7deb61cb5210fd180755d6e9d6615c0
Status: Image is up to date for localhost:1234/skopeo1:myname
[ipanova@ina pulp_development]$ pulp-admin docker repo list --repo-id skopeo1
Warning: path should have mode 0700 because it may contain sensitive information: /home/ipanova/.pulp/

+----------------------------------------------------------------------+
                          Docker Repositories
+----------------------------------------------------------------------+

Id:                   skopeo1
Display Name:         None
Description:          None
Content Unit Counts:  
  Docker Blob:     2
  Docker Manifest: 1
  Docker Tag:      1

[ipanova@ina pulp_development]$ pulp-admin docker repo search manifest --repo-id skopeo1
Warning: path should have mode 0700 because it may contain sensitive information: /home/ipanova/.pulp/

Created:      2018-01-08T18:31:47Z
Metadata:     
  Config Layer:       sha256:6ad733544a6317992a6fac4eb19fe1df577d4dec7529efec28a
                      5bd0edad0fd30
  Digest:             sha256:b25c0292200c1a9c29a86d367f7e9d05d7deb61cb5210fd1807
                      55d6e9d6615c0
  Downloaded:         True
  Fs Layers:          
    Blob Sum:   sha256:0ffadd58f2a61468f527cc4f0fc45272ee4a1a428abe014546c89de2a
                a6a0eb5
    Layer Type: application/vnd.docker.image.rootfs.diff.tar.gzip
  Pulp User Metadata: 
  Schema Version:     2
Repo Id:      skopeo1
Unit Id:      8c218996-b72b-4a49-a8ab-f72127462771
Unit Type Id: docker_manifest
Updated:      2018-01-08T18:31:47Z

[ipanova@ina pulp_development]$ pulp-admin docker repo search tag --repo-id skopeo1
Warning: path should have mode 0700 because it may contain sensitive information: /home/ipanova/.pulp/

Created:      2018-01-18T15:03:15Z
Metadata:     
  Manifest Digest:    sha256:b25c0292200c1a9c29a86d367f7e9d05d7deb61cb5210fd1807
                      55d6e9d6615c0
  Manifest Type:      image
  Name:               myname
  Pulp User Metadata: 
  Repo Id:            skopeo1
  Schema Version:     2
Repo Id:      skopeo1
Unit Id:      a538abdc-7732-4893-8c9a-4c195e88461c
Unit Type Id: docker_tag
Updated:      2018-01-18T15:03:15Z

Please close the issue when you feel like it's the time.

#4 Updated by mihai.ibanescu@gmail.com almost 4 years ago

This is not a pulp bug.

In our environment we use nginx and uwsgi. uwsgi was configured to listen to a wsgi socket, and apparently the wsgi protocol does not support multiple valued headers.

Switching to http sockets solved the problem.

#5 Updated by mihai.ibanescu@gmail.com almost 4 years ago

  • Status changed from NEW to CLOSED - NOTABUG

#6 Updated by bmbouter over 2 years ago

  • Tags Pulp 2 added

Please register to edit this issue

Also available in: Atom PDF