# 守护进程错误响应：未授权：用户名或密码不正确

- **ID:** `docker/registry-unauthorized-401`
- **领域:** docker
- **类别:** auth_error
- **错误码:** `401`
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

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

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Docker 24.0.6 | active | — | — |
| Docker 25.0.1 | active | — | — |
| Docker Hub | active | — | — |

## 解决方案

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.
   ```

## 无效尝试

- **docker logout && docker login** — Logging out and logging in again with same credentials does not fix incorrect password. (80% 失败率)
- **sudo docker login** — Using sudo docker login changes the context but not the credential validity. (70% 失败率)
- **rm ~/.docker/config.json** — Deleting ~/.docker/config.json removes all credentials, but re-login with wrong password still fails. (60% 失败率)
