401
docker
auth_error
ai_generated
true
守护进程错误响应:未授权:用户名或密码不正确
Error response from daemon: unauthorized: incorrect username or password
ID: docker/registry-unauthorized-401
90%修复率
87%置信度
1证据数
2024-02-28首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Docker 24.0.6 | active | — | — | — |
| Docker 25.0.1 | active | — | — | — |
| Docker Hub | active | — | — | — |
根因分析
Docker 私有仓库的凭据无效、过期或未提供,导致推送/拉取时身份验证失败。
English
Docker credentials for a private registry are invalid, expired, or not provided, causing authentication to fail during push/pull.
官方文档
https://docs.docker.com/engine/reference/commandline/login/解决方案
-
Re-authenticate with correct credentials: docker login registry.example.com -u username -p new_password
-
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
-
Check credential store: cat ~/.docker/config.json and verify credsStore or auths. If using credential helper, ensure it's configured correctly.
无效尝试
常见但无效的做法:
-
docker logout && docker login
80% 失败
Logging out and logging in again with same credentials does not fix incorrect password.
-
sudo docker login
70% 失败
Using sudo docker login changes the context but not the credential validity.
-
rm ~/.docker/config.json
60% 失败
Deleting ~/.docker/config.json removes all credentials, but re-login with wrong password still fails.