Files
nexus/wiki/concepts/Docker-Daemon代理.md
weishen e62797a33a Batch 9: Obsidian插件/AI开源平替/Coze培训/TK面单/Ubuntu科学上网
- Sources: 5个新文档
- Concepts: ProxyChains, SOCKS5代理, Docker Daemon代理
- Index: 更新至 Batch 9
- 累计 sources: 108/182
2026-04-16 06:36:36 +08:00

41 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: docker-daemon-proxy
title: Docker Daemon 代理
type: concept
tags: [Docker, 代理, Ubuntu, systemd]
sources: []
last_updated: 2026-04-16
---
## Definition
Docker 守护进程Daemon级代理配置。`docker pull` 等操作由 Daemon 执行,不读取用户环境变量,必须通过 systemd 环境变量注入。
## Configuration
创建 `/etc/systemd/system/docker.service.d/http-proxy.conf`
```ini
[Service]
Environment="HTTP_PROXY=http://127.0.0.1:10808/"
Environment="HTTPS_PROXY=http://127.0.0.1:10808/"
Environment="NO_PROXY=localhost,127.0.0.1"
```
执行生效:`sudo systemctl daemon-reload && sudo systemctl restart docker`
验证:`docker info | grep -i proxy`
## Key Distinction
| 层级 | 配置文件 | 作用范围 |
|------|---------|---------|
| Daemon 级 | systemd unit override | docker pull/build 等 |
| 容器内应用级 | ~/.docker/config.json | 容器内 apt-get/pip 等 |
| Compose 环境变量 | docker-compose.yml | 单个服务 |
## Connections
- [[Docker]] ← Docker 守护进程配置
- [[SOCKS5 代理]] ← Daemon 通常连接 SOCKS5 转换 HTTP
- [[V2RayN]] ← 提供本地代理端口