[−][src]Crate oci_registry_client
A async client for OCI compliant image registries and Docker Registry HTTP V2 protocol.
Usage
The DockerRegistryClientV2
provides functions to query Registry API and download blobs.
use std::{path::Path, fs::File, io::Write}; use oci_registry_client::DockerRegistryClientV2; let mut client = DockerRegistryClientV2::new( "registry.docker.io", "https://registry-1.docker.io", "https://auth.docker.io/token" ); let token = client.auth("repository", "library/ubuntu", "latest").await?; client.set_auth_token(Some(token)); let manifest = client.manifest("library/ubuntu", "latest").await?; println!("{:?}", manifest); for layer in &manifest.layers { let mut out_file = File::create(Path::new("/tmp/").join(&layer.digest.to_string()))?; let mut blob = client.blob("library/ubuntu", &layer.digest).await?; while let Some(chunk) = blob.chunk().await? { out_file.write_all(&chunk)?; } }
Modules
blob | A "blob" representation. |
errors | Error representation. |
manifest | Image manifest structs. |
Structs
AuthToken | OAuth 2.0 token. |
DockerRegistryClientV2 | Client to fetch image manifests and download blobs. |
Version |