-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 export should only put the tag into org.opencontainers.image.ref.name in index.json #4615
Comments
Is this a recent regression? |
I don't know. I would expect that it was always this way. I think it should be at least possible to set "org.opencontainers.image.ref.name" to something like a tag only, e.g., "1.0.0", if the user intends it that way, e.g., by using the "name" property. |
Looking at moby/moby#47232, I see that moby uses two separate annotations; "annotations": {
"io.containerd.image.name": "docker.io/library/hello-world:latest",
"org.opencontainers.image.ref.name": "latest"
}, I wonder if those got confused for being equivalent 🤔 /cc @jedevc (ISTR you worked on OCI export) |
Looks like this was originally added in https://github.com/moby/buildkit/pull/615/files#diff-d77a9a4e3d44aebce1412917bb17e4cdf95b7cfcb8bebca87b68aea48eded183R31 I remember this being significant, see: buildkit/client/ociindex/ociindex.go Lines 128 to 132 in d6e1426
And maybe also docker/buildx#1456. This is the field used to do lookups in this file - at least for cache input lookups. The default field is "latest". And based on the above buildx PR, we want it to be a tag (and use the full containerd image.name for the full name). This behavior of exporting the full name here instead of the tag definitely seems incorrect If someone can figure out where the wrong label comes from, would definitely be happy to take a PR for this. |
The wrong label comes from ParseNormalizedNamed if I am not mistaken: https://github.com/moby/containerd/blob/96c5ae04b6784e180aaeee50fba715ac448ddb0d/reference/docker/reference.go#L609, |
( |
In other words, it's a bug in Zot to assume |
Hi @tianon, per OCI dist spec the This part of the OCI image spec mentions the use case of tags https://github.com/opencontainers/image-spec/blob/main/image-layout.md?plain=1#L153, and doesn't mention anything about the other folders in path being part of that annotation. Can you point me to the part of the OCI specs (dist or image spec) where they define this |
The canonical reference that defines what Quote:
(note especially that eBNF grammar which is defined explicitly and intentionally to support "full" image references here as in See also opencontainers/tob#114, which is a related proposal (although only tangentially related). |
Still, that section of the OCI spec does not define in https://github.com/opencontainers/image-spec/blob/v1.1.0/annotations.md#pre-defined-annotation-keys what the components represent. The role of a spec is to standardize so different implementations to be compatible. It is supposed to be a contract so the two sides involved in writing to and reading from the OCI spec can build compatible software. Now it is not. We could implement in zot picking up the tag Thinking about cases such as:
In short, anyone can come up with their own component(s) according to the grammar, and claim everyone else is not compliant with their interpretation of the spec. So I am very reluctant to implement something not explicitly mentioned in the spec. Using the tag alone as |
Unfortunately, the concept of a reference isn't standardized, yet. So there's nothing within OCI to point to. I don't think there are enough people actively maintaining the specs to do that right now. |
I noticed the following issue while trying to use the oci exporter to export an image directly into a filesystem folder, which is used by the zot registry.
The exported index.json contains "org.opencontainers.image.ref.name":"foo/bar:1.0.0", whereas I expect it to be "org.opencontainers.image.ref.name":"1.0.0".
The property "org.opencontainers.image.ref.name" in the index.json contains the whole image name together with the tag. The zot registry expects that only the tag should be in that property, and does not accept the generated index.json.
According to the OCI spec, this property should only hold the tag, and not the complete image name together with a tag, see https://github.com/opencontainers/image-spec/blob/main/image-layout.md#indexjson-file
The text was updated successfully, but these errors were encountered: