Docker "unauthorized: authentication required" on pull in CI
The registry demanded credentials the job did not supply. The session is logged out, the token expired, or the image is private and the pull is anonymous.
What this error means
A pull or FROM resolution fails with unauthorized: authentication required. Re-authenticating with a valid token resolves it.
docker
Error response from daemon: unauthorized: authentication requiredCommon causes
Expired or missing token
A short-lived registry token (ECR, GHCR) expired, or no login ran in this job.
Private image pulled anonymously
The image requires auth but the job never logged in.
How to fix it
Refresh authentication
- Run a fresh login before the pull, using a current token.
Terminal
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin <acct>.dkr.ecr.us-east-1.amazonaws.comAuthenticate in the workflow
- Use a login action so credentials are present for the pull.
.github/workflows/build.yml
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}How to prevent it
- Log in to the registry inside the same job that pulls, and refresh short-lived tokens (ECR/GHCR) right before use. This is a credentials issue, so a retry alone will not fix it.
Frequently asked questions
What causes ""unauthorized: authentication required""?
A short-lived registry token (ECR, GHCR) expired, or no login ran in this job.
How do I fix "unauthorized: authentication required"?
Refresh authentication
Related guides
Docker "pull access denied" for a base image in CIFix the Docker "pull access denied ... repository does not exist" error in CI, caused by a private base image…
Docker "403 Forbidden" from ECR/GHCR auth in CIFix the Docker "403 Forbidden" error pulling or pushing to ECR or GHCR in CI, caused by an expired registry t…
Docker "manifest unknown" in CIFix the Docker "manifest unknown" / "manifest for ... not found" pull error in CI, caused by a tag or digest…