Objective
Reproduce a registry auth failure and fix it.
Tasks
Task 1: Attempt to pull from a private registry without auth
docker pull registry.example.com/myorg/app:1.0.0
# Error response from daemon: Head ... no basic auth credentials
Task 2: Log in
docker login registry.example.com
# Username: myorg
# Password: ********
docker pull registry.example.com/myorg/app:1.0.0
Task 3: Verify credentials are stored
cat ~/.docker/config.json | jq '.auths'
# The registry is listed with an encrypted credential.
Task 4: Diagnose an expired token
Rotate the password in the registry, then attempt to pull again:
docker pull registry.example.com/myorg/app:1.0.0
# unauthorized: authentication required
docker login registry.example.com fixes it.
Task 5: Use a credential helper
For CI / automation, avoid interactive login:
# Create a credential helper
docker-credential-secretservice list
# or
echo 'registry.example.com' | docker-credential-ecr-login get
Configure in ~/.docker/config.json:
{
"credHelpers": {
"registry.example.com": "ecr-login"
}
}