Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

[19.03 backport] Use ocischema package instead of custom handler #405

Merged

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Oct 14, 2019

backport of moby#40070

Fixes moby#39727
Addresses docker/hub-feedback#1871 (comment)
Relates to distribution/distribution#3024

Previously we were re-using schema2.DeserializedManifest to handle oci
manifests. The issue lies in the fact that distribution started
validating the media type string during json deserialization. This
change broke our usage of that type.

Instead distribution now provides direct support for oci schemas, so use
that instead of our custom handlers.

On 19.03:

$ docker run -it --rm cpuguy83/mobyissue39727:latest cat /foo
Unable to find image 'cpuguy83/mobyissue39727:latest' locally
docker: Error response from daemon: mediaType in manifest should be 'application/vnd.docker.distribution.manifest.v2+json' not 'application/vnd.oci.image.manifest.v1+json'.
See 'docker run --help'.

With this change:

# docker run -it --rm cpuguy83/mobyissue39727:latest cat /foo
Unable to find image 'cpuguy83/mobyissue39727:latest' locally
latest: Pulling from cpuguy83/mobyissue39727
9d48c3bd43c5: Pull complete 
ada774eec8cc: Pull complete 
Digest: sha256:1afcf1bc336b1dbb346fef91b8e2b648f90c801a446cec214c46f544eb3608c8
Status: Downloaded newer image for cpuguy83/mobyissue39727:latest
hello

- Description for the changelog

Previously we were re-using schema2.DeserializedManifest to handle oci
manifests. The issue lies in the fact that distribution started
validating the media type string during json deserialization. This
change broke our usage of that type.

Instead distribution now provides direct support for oci schemas, so use
that instead of our custom handlers.

Signed-off-by: Brian Goff <[email protected]>
(cherry picked from commit e443512)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah
Copy link
Member Author

@cpuguy83

Copy link

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@dmcgowan dmcgowan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah
Copy link
Member Author

Some weird failure in docker-py; https://ci.docker.com/public/blue/rest/organizations/jenkins/pipelines/engine/branches/PR-405/runs/2/nodes/203/log/?start=0

[2019-10-17T15:17:38.261Z] docker/api/client.py:261: in _raise_for_status
[2019-10-17T15:17:38.261Z]     response.raise_for_status()
[2019-10-17T15:17:38.261Z] /usr/local/lib/python3.7/site-packages/requests/models.py:940: in raise_for_status
[2019-10-17T15:17:38.261Z]     raise HTTPError(http_error_msg, response=self)
[2019-10-17T15:17:38.261Z] E   requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http+docker://localhost/v1.35/images/hello-world:latest/get

Restarting CI

Copy link

@andrewhsu andrewhsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

@andrewhsu andrewhsu merged commit 967aa3a into docker-archive:19.03 Oct 28, 2019
@thaJeztah thaJeztah deleted the 19.03_backport_oci_regression branch October 28, 2019 17:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants