containers / image

Work with containers' images
Apache License 2.0
862 stars 375 forks source link

Add oci/layout.Reader #1563

Open tanguofu opened 2 years ago

tanguofu commented 2 years ago

when skeopeo copy many images into one oci repo, how can i get the images name?
for example the index.json:

"schemaVersion":2,"manifests":[{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:2ba9d0aec419c8dd71c584de4b726001e549514f770c5f3058775262a734a4d3","size":1813,"annotations":{"org.opencontainers.image.ref.name":"platform/mysql:8.0.27-aarch64"}},{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:a4cfae91a5fcd73287fce2a701264da5241c6778b29877ca57f6bc74c50eba70","size":2308,"annotations":{"org.opencontainers.image.ref.name":"platform/devops-tools:latest-aarch64"}}
...

there only a API https://github.com/containers/image/blob/main/oci/layout/oci_transport.go#L219

func LoadManifestDescriptor(imgRef types.ImageReference) (imgspecv1.Descriptor, error) {

so is it acceptable to add a API get [] imgspecv1.Descriptor of all the name within oci repo ? , such as:

func LoadAllManifestDescriptor(imgRef types.ImageReference) ([] imgspecv1.Descriptor, error) {

and i would very like tocontribute with a PR.

many thanks.

vrothberg commented 2 years ago

Thank you for reaching out, @tanguofu.

Can you describe on a high level what you are trying to do? Do you want to use skopeo copy or do you want to inspect the images names via skopeo inspect?

mtrmac commented 2 years ago

If I understand the request correctly, see #1381 ’s Reader (and compare docker/archive). Introducing a similar API for oci/layout (with much less state to maintain) would make sense to me.

mtrmac commented 1 week ago

Some variant of this will probably happen in #2567 .