Docker Push to AWS ECR Failed: no basic auth credentials (12-Hour Token Expiry)

ECR `docker login` authorization token expires every 12 hours.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.1.0
Identifier: Docker Push to AWS ECR Failed Platform: Cloud
Common Root Causes:
  • ECR `docker login` authorization token expires every 12 hours.

Interactive Diagnostic Checklist

Verified Solutions:
  1. Re-authenticate via `aws ecr get-login-password | docker login --username AWS --password-stdin <acct>.dkr.ecr.<reg>.amazonaws.com`.
Safe Diagnostic Command:
aws ecr get-login-password --region <reg>
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.

Technical Explanation

ECR `docker login` authorization token expires every 12 hours. Recommended diagnostic: `aws ecr get-login-password --region <reg>`. Remediation: Re-authenticate via `aws ecr get-login-password | docker login --username AWS --password-stdin <acct>.dkr.ecr.<reg>.amazonaws.com`.

Worked Examples

  • Run `aws ecr get-login-password --region <reg>` to verify root cause before applying the remediation.

Limitations & Assumptions

  • Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.

Source References & Verification

Resource ID: err-aws-ecr-401-no-basic-auth · Independently verified: 2026-11-25

Related Resources