Skip to content

Also support manifest lists (multi-arch docker images, docker apps) #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

ndeloof
Copy link

@ndeloof ndeloof commented Aug 28, 2019

No description provided.

@jessfraz
Copy link
Collaborator

can you add a test to verify this works, pulling one from docker hub should suffice, thanks!

(used by docker apps)

Signed-off-by: Nicolas De Loof <[email protected]>
@ndeloof
Copy link
Author

ndeloof commented Sep 18, 2019

added a test case to inspect a docker app of mine pushed as OCI index list on docker hub

log content-type to help diagnostic on supported manifests' media types

Signed-off-by: Nicolas De Loof <[email protected]>
@ndeloof
Copy link
Author

ndeloof commented Sep 19, 2019

Added a test case pulling a docker app of mine.

some additional notes

without extended Accept header, multi-arch docker image busybox manifest is served by DockerHub as application/vnd.docker.distribution.manifest.v2+json:

{
   "schemaVersion": 2,
   "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
   "config": {
     "mediaType": "application/vnd.docker.container.image.v1+json",
     "size": 1497,
     "digest": "sha256:19485c79a9bbdca205fce4f791efeaa2a103e23431434696cc54fdd939e9198d"
   },
   "layers": [
     {
       "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
       "size": 760770,
       "digest": "sha256:7c9d20b9b6cda1c58bc4f9d6c401386786f584437abbe87e58910f8a9a15386b"
     }
   ]
 }

which is actually the manifest for the linux/amd64 flavour of this image.

With additional "manifest list" Accept header DockerHub do serve manifest for the same busybox image as application/vnd.docker.distribution.manifest.list.v2+json:

{
   "manifests": [
     {
       "digest": "sha256:dd97a3fe6d721c5cf03abac0f50e2848dc583f7c4e41bf39102ceb42edfd1808",
       "mediaType": "application\/vnd.docker.distribution.manifest.v2+json",
       "platform": {
         "architecture": "amd64",
         "os": "linux"
       },
       "size": 527
     },
...       
   ],
   "mediaType": "application\/vnd.docker.distribution.manifest.list.v2+json",
   "schemaVersion": 2
 }

Then reg can be used to get manifest for the target architecture using busybox@sha256:dd97a3fe6d721c5cf03abac0f50e2848dc583f7c4e41bf39102ceb42edfd1808

So this PR will change reg behaviour for multi-architecture images, which is actually correct from a pure OCI manifest management point of view, but may be a breaking change for users.

Maybe we should just introduce a CLI option so that end-user can select Manifest type to query by registry API ? I suggest using --index to enable manifest list (a.k.a OCI index) and --oci to force OCI compliance mode. Maybe we could also offer even more control with --media-type so end user can explicitly set Accept header being used?

@ndeloof
Copy link
Author

ndeloof commented Sep 19, 2019

Just notice this PR is duplicating #191

This let user tune the media type to be used to get manifest, without breaking compatibility.

Signed-off-by: Nicolas De Loof <[email protected]>
@mcrosson
Copy link

mcrosson commented Dec 2, 2019

@ndeloof Is there any way to extend this into the server command of reg as well? I'm reading through the code and can't quite figure out how I'd go about an update of this nature.

I'm not a go dev and this feels like it might be easier for someone who's got more experience with such things.

@ndeloof ndeloof closed this May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants