← Back to all fixes
docker push fails with authentication required in CI
The Issue
CI step `docker push myregistry/myapp:v1` fails: `unauthorized: authentication required`
Root Cause
The CI runner is not logged into the registry. Credentials either not set or incorrectly referenced.
How to Fix
Add a login step before push: `docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY`Store credentials as CI secrets, not hardcoded in the YAMLFor ECR (AWS): use `aws ecr get-login-password | docker login --username AWS --password-stdin <registry>`For GCR: use `gcloud auth configure-docker` or a service account keyVerify the secret names match what your YAML references exactly (case-sensitive)