feat: 新增 TOOLS 标准模板第19章 - Ubuntu Docker proxychains4 代理拉取镜像 (2026-04-05)

This commit is contained in:
2026-04-05 21:46:29 +08:00
parent 98b469b97c
commit 66b54cc85e
2 changed files with 66 additions and 75 deletions

View File

@@ -748,3 +748,35 @@ ssh ubuntu2 "rm /home/shenwei/docker/n8n/n8n_data/files/<输出文件名>"
| 工作流 | Webhook Path | 输入文件规则 | 输出文件规则 | 通知方式 |
| ---- | ------------------------ | -------------------- | ------------------------- | -------- |
| 内容转化 | `content-translation-v6` | `content-queue/*.md` | `content-out/*_output.md` | Telegram |
## 19.Ubuntu Docker 通过 proxychains4 走代理拉取镜像 (2026-04-05)
### 问题背景
Ubuntu2 服务器直连 Docker Hub 的 443 端口被封,导致 `docker pull/build` 超时。Ubuntu2 上已安装 `proxychains4`,可用于将 Docker 的 TCP 连接通过 SOCKS5 代理转发。
### 验证 proxychains4 是否可用
```bash
ssh ubuntu2 'proxychains4 curl -s -o /dev/null -w "HTTP %{http_code}" --max-time 8 https://registry-1.docker.io/v2/'
# 预期输出: HTTP 401 (TCP 接通,认证失败表示通道打通)
```
### Docker pull 走代理
```bash
ssh ubuntu2 'proxychains4 docker pull <image>:<tag>'
```
### Docker build 走代理
```bash
ssh ubuntu2 'proxychains4 docker build --pull=false -t <image>:<tag> <dockerfile-path>'
```
### 注意事项
- **SOCKS5 vs HTTP**: Xray/V2Ray 通常提供 SOCKS5 代理proxychains4 在 TCP 层转发流量,不依赖 HTTP 代理设置
- **--pull=false**: 在已有本地镜像时使用,避免 build 过程中再次拉取基础镜像(耗时且仍可能失败)
- **apt-get 不走代理**: Docker build 过程中 apt-get install 走的是直连 Debian 源,不受影响
- **Docker daemon vs client**: proxychains4 包裹的是 docker 命令,而非 dockerd 守护进程