oras-project / rust-oci-client

A Rust crate to interact with OCI registries
Apache License 2.0
96 stars 53 forks source link

Support manifest list #27

Closed thomasgouveia closed 1 year ago

thomasgouveia commented 2 years ago

Hello,

First, thanks for your work on this crate, it is very helpful!

I'm interested in the manifest list feature. Currently, I work on a crate to provide the ability to pull OCI images for a school project. So I need to be able to pull for example alpine or ubuntu images from docker.io/library.

For example, when I use the pull_manifest_and_config method of your Client, I have this error :

unsupported media type: application/vnd.docker.distribution.manifest.list.v2+json

I checked your code and I see that the crates do not support the manifest list feature. Is this something under consideration? I see there is a TODO in your code, but no more information about future implementation. If not, did you know if there is a workaround to be able to pull those images?

Thank you!

Thomas

bacongobbler commented 2 years ago

Hi @thomasgouveia. Have you had a chance to look at the PR queue? I see https://github.com/krustlet/oci-distribution/pull/26 attempts to resolve some use cases with manifest lists.

I’m curious to hear what issues you’re seeing and what features you’d like to see made available.

thomasgouveia commented 2 years ago

Yes, I've looked #26, but I'm not sure it resolves my use case. #26 is focused on the ability to push manifest lists, and not on pulling. What I'm interested in is the ability to pull images such as docker.io/library/alpine or docker.io/library/ubuntu.

To give you an idea, currently, with this piece of code :

pub async fn pull_manifest(&mut self) -> Result<(OciManifest, String, String)> {
  self.client
      .pull_manifest_and_config(&self.reference, &self.auth)
      .await
      .map_err(|e| Error::PullManifest(e.to_string()))?
}

When my reference is parsed from docker.io/library/ubuntu, I have the following error :

unsupported media type: application/vnd.docker.distribution.manifest.list.v2+json

So that's ok, as I said in my first comment.

But it is strange, because if I use docker.io/amd64/ubuntu, it works great.

I'm not sure to understand the difference between those two OCI references, and how the process has to be different for each.