Some checks failed
Build and Deploy / test-backend (push) Has been cancelled
Build and Deploy / build-backend (push) Has been cancelled
Build and Deploy / build-admin (push) Has been cancelled
Deploy to Production / build-backend (push) Has been cancelled
Deploy to Production / deploy (push) Has been cancelled
Co-authored-by: Cursor <cursoragent@cursor.com>
95 lines
1.8 KiB
Markdown
95 lines
1.8 KiB
Markdown
# Docker Desktop 镜像加速配置(修正版)
|
||
|
||
## ✅ 正确的 JSON 配置
|
||
|
||
复制以下配置到 Docker Desktop → Settings → Docker Engine:
|
||
|
||
```json
|
||
{
|
||
"builder": {
|
||
"gc": {
|
||
"defaultKeepStorage": "20GB",
|
||
"enabled": true
|
||
}
|
||
},
|
||
"experimental": false,
|
||
"registry-mirrors": [
|
||
"https://docker.mirrors.ustc.edu.cn",
|
||
"https://hub-mirror.c.163.com",
|
||
"https://mirror.baidubce.com"
|
||
]
|
||
}
|
||
```
|
||
|
||
## ⚠️ 常见错误
|
||
|
||
### 错误 1:缺少逗号
|
||
|
||
❌ **错误**:
|
||
```json
|
||
{
|
||
"experimental": false
|
||
"registry-mirrors": [...]
|
||
}
|
||
```
|
||
|
||
✅ **正确**:
|
||
```json
|
||
{
|
||
"experimental": false,
|
||
"registry-mirrors": [...]
|
||
}
|
||
```
|
||
|
||
### 错误 2:JSON 格式错误
|
||
|
||
确保:
|
||
- 所有键都用双引号包裹
|
||
- 最后一个属性后不要有逗号
|
||
- 数组和对象正确闭合
|
||
|
||
## 配置步骤
|
||
|
||
1. **打开 Docker Desktop**
|
||
2. **Settings** → **Docker Engine**
|
||
3. **替换整个 JSON 配置**(或添加 `registry-mirrors` 部分)
|
||
4. **点击 Apply & Restart**
|
||
5. **等待重启完成**
|
||
|
||
## 验证配置
|
||
|
||
重启后,在 PowerShell 中运行:
|
||
|
||
```powershell
|
||
docker info | Select-String -Pattern "Registry Mirrors" -Context 0,3
|
||
```
|
||
|
||
应该能看到配置的镜像源列表。
|
||
|
||
## 如果已有其他配置
|
||
|
||
如果 Docker Engine 中已有其他配置,只需要添加 `registry-mirrors` 部分:
|
||
|
||
```json
|
||
{
|
||
"existing-config": "...",
|
||
"registry-mirrors": [
|
||
"https://docker.mirrors.ustc.edu.cn",
|
||
"https://hub-mirror.c.163.com",
|
||
"https://mirror.baidubce.com"
|
||
]
|
||
}
|
||
```
|
||
|
||
## 配置完成后
|
||
|
||
配置完成后,重新构建镜像:
|
||
|
||
```powershell
|
||
# 构建 Backend
|
||
docker build -f deploy/docker/backend.Dockerfile -t registry.667788.cool/wecom-ai/wecom-ai-backend:latest .
|
||
|
||
# 推送
|
||
docker push registry.667788.cool/wecom-ai/wecom-ai-backend:latest
|
||
```
|