## 方法一
# 1.创建文件
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo vim /etc/systemd/system/docker.service.d/http-proxy.conf
# 2.文件内容如下
[Service]
Environment="HTTP_PROXY=http://127.0.0.1:8123"
Environment="HTTPS_PROXY=http://127.0.0.1:8123"
# 3.重启服务
sudo systemctl daemon-reload
sudo systemctl restart docker
## 方法一
# 编辑 /etc/docker/daemon.json 增加如下内容
{
"proxies": {
"http-proxy": "http://192.168.1.5:7890",
"no-proxy": "localhost,127.0.0.0/8",
"https-proxy": "http://192.168.1.5:7890"
}
}
# 重启服务
sudo systemctl restart docker
Last active
August 17, 2025 04:51
-
-
Save wbmins/2923f9529f7e620de732f73bc646e5c7 to your computer and use it in GitHub Desktop.
docker 设置代理
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment