401 docker auth_error ai_generated true

Error response from daemon: unauthorized: incorrect username or password

ID: docker/registry-unauthorized-401

Also available as: JSON · Markdown · 中文
90%Fix Rate
87%Confidence
1Evidence
2024-02-28First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Docker 24.0.6 active
Docker 25.0.1 active
Docker Hub active

Root Cause

Docker credentials for a private registry are invalid, expired, or not provided, causing authentication to fail during push/pull.

generic

中文

Docker 私有仓库的凭据无效、过期或未提供,导致推送/拉取时身份验证失败。

Official Documentation

https://docs.docker.com/engine/reference/commandline/login/

Workarounds

  1. 95% success Re-authenticate with correct credentials: docker login registry.example.com -u username -p new_password
    Re-authenticate with correct credentials: docker login registry.example.com -u username -p new_password
  2. 90% success If using access tokens (e.g., GitHub Container Registry), generate a new token and use it: docker login ghcr.io -u username --password-stdin < token.txt
    If using access tokens (e.g., GitHub Container Registry), generate a new token and use it: docker login ghcr.io -u username --password-stdin < token.txt
  3. 80% success Check credential store: cat ~/.docker/config.json and verify credsStore or auths. If using credential helper, ensure it's configured correctly.
    Check credential store: cat ~/.docker/config.json and verify credsStore or auths. If using credential helper, ensure it's configured correctly.

中文步骤

  1. Re-authenticate with correct credentials: docker login registry.example.com -u username -p new_password
  2. If using access tokens (e.g., GitHub Container Registry), generate a new token and use it: docker login ghcr.io -u username --password-stdin < token.txt
  3. Check credential store: cat ~/.docker/config.json and verify credsStore or auths. If using credential helper, ensure it's configured correctly.

Dead Ends

Common approaches that don't work:

  1. docker logout && docker login 80% fail

    Logging out and logging in again with same credentials does not fix incorrect password.

  2. sudo docker login 70% fail

    Using sudo docker login changes the context but not the credential validity.

  3. rm ~/.docker/config.json 60% fail

    Deleting ~/.docker/config.json removes all credentials, but re-login with wrong password still fails.