Skip to main content

Crate containerregistry_auth

Crate containerregistry_auth 

Source
Expand description

Docker config and credential helper integration.

This crate provides functionality for resolving container registry credentials from Docker config files and credential helpers.

§Overview

The main types in this crate are:

§Example

use containerregistry_auth::{AuthResolver, Credential};

// Create a resolver that loads from default Docker config
let resolver = AuthResolver::new();

// Resolve credentials for a registry
let cred = resolver.resolve("gcr.io")?;

// Use the credential
if let Some(header) = cred.authorization_header() {
    println!("Authorization: {}", header);
}

§Resolution Order

The resolver checks multiple sources in order of precedence:

  1. Explicit credentials (if set via AuthResolver::with_explicit)
  2. Docker config auths section (base64-encoded or plaintext)
  3. Registry-specific credential helper (credHelpers)
  4. Default credential store (credsStore)
  5. Anonymous access (fallback)

Structs§

AuthEntry
An auth entry from the Docker config’s “auths” section.
AuthResolver
A resolver for container registry credentials.
CredentialHelper
A credential helper that can retrieve credentials for registries.
DockerConfig
Docker config file structure.
HelperCredential
Response from a credential helper’s “get” command.

Enums§

Credential
A credential for authenticating to a container registry.
Error
Errors that can occur during auth operations.

Type Aliases§

Result
Result type for auth operations.