Skip to content
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

OCI archive-equivalent to "RepoTags" #796

Closed
TadCordle opened this issue Dec 4, 2019 · 5 comments
Closed

OCI archive-equivalent to "RepoTags" #796

TadCordle opened this issue Dec 4, 2019 · 5 comments

Comments

@TadCordle
Copy link

In a docker load-able tar, the manifest contains a RepoTags field, which can list multiple different image references. When you docker load the tar, docker images then displays the image multiple times, named with each of the tags found in RepoTags.

Is there an equivalent way to do this in an OCI archive? I see index.json can use an org.opencontainers.image.ref.name annotation, but that only accepts one image name, not a list.

@dmcgowan
Copy link
Member

dmcgowan commented Dec 4, 2019

@TadCordle this can be accomplished by listing the descriptor multiple times, once per tag. Since the underlying content is the same, the duplication only occurs in the index.json and nothing else is duplicated.

We (on containerd) explored a few different options here to make the OCI format compatible with Docker's, this ultimately ended up being the cleanest. The containerd export code now generates an archive which can both be loaded back into existing Docker versions (1.10+) as well as future version which will support loading the OCI archives directly.

@TadCordle
Copy link
Author

TadCordle commented Dec 4, 2019

To be sure, are you suggesting listing the same manifest multiple times in index.json, like this?

{
  "schemaVersion": 2,
  "manifests": [
    {
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "digest": "sha256:abcd....",
      "size": 1000,
      "annotations": {
        "org.opencontainers.image.ref.name": "image:tag"
      }
    },
    {
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "digest": "sha256:abcd....",  <-- (same digest)
      "size": 1000,
      "annotations": {
        "org.opencontainers.image.ref.name": "image:differenttag"
      }
    }
  ]
}

I've been using podman to try to test running the OCI images I'm generating, and it seems to have issues with this sort of index. Using podman load < image.tar with multiple manifests entries:

open /var/tmp/podman675604817/manifest.json: not a directory

Using podman pull oci-archive:image.tar:

error loading index: more than one image in oci, choose an image

Do you think these are issues with podman, or the index.json I'm writing?

@dmcgowan
Copy link
Member

dmcgowan commented Dec 4, 2019

The index looks valid, I would file an issue there as I am sure that is a case intended to work. I am not familiar with their UX though if there other expected ways to support that, supporting the archives has been tricky from a CLI UX perspective.

@TadCordle
Copy link
Author

TadCordle commented Dec 4, 2019

Since this doesn't seem to be a problem with the spec, I'll close this for now and keep an eye on containers/podman#4646. Thanks for the help!

@cyphar
Copy link
Member

cyphar commented Dec 5, 2019

Yeah this is a limitation of containers/image -- though it should be noted that skopeo does have a way to set repoTags through a CLI option (but because of the containers/image limitation it can't look at the index to figure out what the repoTags should be).

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

No branches or pull requests

3 participants