oras icon indicating copy to clipboard operation
oras copied to clipboard

Store full image reference during oras backup

Open AustinAbro321 opened this issue 2 months ago • 5 comments

What is the version of your ORAS CLI

1.3.0

What would you like to be added?

I would like the full image reference to be stored in the image during oras backup.

I can see a few ways of accomplishing this:

  • We could add the entire image reference to org.opencontainers.image.title.
  • If we have an appetite for breaking changes, we could simply add the entire image reference to org.opencontainers.image.ref.name
  • We could add the tag to org.opencontainers.image.ref.name and the base name to org.opencontainers.image.base.name

Why is this needed for ORAS?

As a maintainer of an air-gap packaging tool called Zarf, I would like Zarf to be able to automatically determine the name of images stored in image tars that my user's add to their package. The docker save command for instance always stores the full image reference under io.containerd.image.name so even if users have images from 10 different repositories, Zarf will know the reference for each when it pushes these images to the air-gap registry.

I would be happy to implement this, however I do not know which annotation strategy the oras project would like to use.

Are you willing to submit PRs to contribute to this feature?

  • [x] Yes, I am willing to implement it.

AustinAbro321 avatar Nov 05 '25 13:11 AustinAbro321

@shizhMSFT @Wwwsylvia @sajayantony Maintainers, please take a look. cc: @FeynmanZhou

This issue should be marked with "feature request".

wangxiaoxuan273 avatar Nov 05 '25 14:11 wangxiaoxuan273

@TerryHowe @FeynmanZhou It is a sub scenario of backing up / restoring multiple repositories across registries.

shizhMSFT avatar Nov 05 '25 14:11 shizhMSFT

Interesting alternatives proposed.

To review the alternatives I attempted:

  1. Tag each image with original registry/repository:tag or repository:tag
  2. Store artifacts backed up in directories based on repository name

One other alternative I was going to look at is add an SBOM to the backup that would correlate the images to the repository or registry/repository.

Pretty much a duplicate of https://github.com/oras-project/oras/issues/730 but this is a smaller subset of the problem in #730

TerryHowe avatar Nov 05 '25 14:11 TerryHowe

Sounds like a valid scenario! @AustinAbro321 thanks for proposing this. We will assign this issue to you.

I personally vote for adding the entire image reference to org.opencontainers.image.title. This looks like more consistent with the OCI image spec.

FeynmanZhou avatar Nov 06 '25 08:11 FeynmanZhou

I went with a simple solution in #1904 of only adding the annotation during backup. This is good enough for my purposes, and to close this issue.

I am curious if there should be a broader stance by oras. As a consumer of oras-go it seems like functions like oras.Copy() expect the entire reference under org.opencontainers.image.ref.name, however this doesn't align with oras backup

AustinAbro321 avatar Nov 13 '25 19:11 AustinAbro321