docker-credentials-config
A Rust library to load Docker client configuration and credentials from ~/.docker/config.json, including support for external credential helpers (osxkeychain, secretservice, pass, etc.).
Installation
[]
= "0.1"
Usage
Load credentials for a specific registry
use DockerConfig;
async
Resolve the registry from an image name
use ;
async
Collect credentials for all known registries
Useful for multi-registry operations like Docker::build_image:
use DockerConfig;
async
Configuration lookup order
DockerConfig::load searches for the configuration file in this order:
$DOCKER_CONFIG/config.json— if theDOCKER_CONFIGenvironment variable is set~/.docker/config.json— standard Docker CLI location
If no file is found, an empty configuration is returned.
Credential resolution
credentials_for_registry delegates to the docker_credential crate, which handles the full Docker credential resolution chain:
- Per-registry helper (
credHelpers) - Inline credentials in the
authssection - Global credential store (
credsStore)
License
MIT