Credential Precedence
When multiple credential sources are available, Check Image follows this priority order:CLI Flags (Highest Priority)
Credentials provided via
--username, --password, or --password-stdin flags.Environment Variables
Credentials set in
CHECK_IMAGE_USERNAME and CHECK_IMAGE_PASSWORD environment variables.The same credentials are applied to all registry requests in a single invocation. For per-registry credentials, use Docker credential helpers.
Authentication Methods
CLI Flags
Provide credentials directly on the command line using flags.Flag Details
Registry username for authentication. Can also be set via
CHECK_IMAGE_USERNAME environment variable.Registry password or token for authentication. Can also be set via
CHECK_IMAGE_PASSWORD environment variable.Read registry password from stdin. Cannot be combined with other flags that also read from stdin (
--config -, --allowed-ports @-, etc.).Environment Variables
Set credentials via environment variables for use in scripts and CI/CD pipelines.Docker Config File
Check Image automatically uses credentials from Docker’s configuration file and credential helpers.This method requires no additional flags or environment variables. Check Image uses the
authn.DefaultKeychain from go-containerregistry, which reads ~/.docker/config.json and invokes credential helpers automatically.Registry-Specific Examples
GitHub Container Registry (GHCR)
GitHub Container Registry requires a Personal Access Token (PAT) with theread:packages scope.
For GitHub Actions workflows, use the
GITHUB_TOKEN secret which is automatically available.Docker Hub
Docker Hub private repositories require a Docker Hub username and password or access token.Amazon ECR
Amazon ECR requires an authorization token obtained via the AWS CLI.Google Container Registry (GCR)
GCR requires a service account key or OAuth token.Azure Container Registry (ACR)
ACR requires Azure credentials.Validation Rules
Check Image enforces several validation rules for credentials:Mutual Exclusivity
Mutual Exclusivity
--password and --password-stdin are mutually exclusive. You cannot use both in the same command.Error
Username Required with Password
Username Required with Password
If you provide a password (via any method), you must also provide a username.
Error
Password Required with Username
Password Required with Username
If you provide a username (via any method), you must also provide a password.
Error
Stdin Conflict
Stdin Conflict
--password-stdin cannot be combined with other flags that read from stdin (--config -, --allowed-ports @-, --registry-policy -, etc.).Error
Security Best Practices
Use --password-stdin
Avoid putting passwords in command-line arguments. Use
--password-stdin or environment variables.Store secrets securely
Use secret management systems (GitHub Secrets, AWS Secrets Manager, HashiCorp Vault) in CI/CD pipelines.
Use credential helpers
Configure Docker credential helpers for automatic per-registry authentication.
Rotate tokens regularly
Use time-limited access tokens instead of long-lived passwords, and rotate them regularly.
Troubleshooting
Authentication Fails with Docker Config
Authentication Fails with Docker Config
Problem: Check Image cannot authenticate even though
docker pull works.Solution: Ensure the Docker credential helper is correctly configured in ~/.docker/config.json. Check Image uses the same credential system as Docker.Verify credentials
Environment Variables Not Working
Environment Variables Not Working
Problem: Environment variables are set but authentication still fails.Solution: Verify both
CHECK_IMAGE_USERNAME and CHECK_IMAGE_PASSWORD are set. Missing one will cause an error.Check variables
Password Visible in Process List
Password Visible in Process List
Problem: Password is visible when running
ps aux.Solution: Use --password-stdin instead of --password to read the password from stdin.Secure approach
Rate Limiting on Docker Hub
Rate Limiting on Docker Hub
Problem: Pulling from Docker Hub returns rate limit errors.Solution: Authenticate with your Docker Hub account to get higher rate limits.
Authenticate
Related Topics
Image Reference Syntax
Learn about transport prefixes and image references
Configuration Files
Understand policy and configuration file formats
GitHub Action
Use Check Image in GitHub Actions workflows
CI/CD Integration
Integrate Check Image into your CI/CD pipeline