Docker 代理配置

docker docker-compose proxy

Posted by gomyck on July 19, 2024

linux 系统下的 docker 代理配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ mkdir -p /etc/systemd/system/docker.service.d

$ cat << EOF > /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://proxy.mac.gomyck.com:7890"
Environment="HTTPS_PROXY=http://proxy.mac.gomyck.com:7890"
Environment="NO_PROXY=localhost,127.0.0.1,::1"
EOF

$ systemctl daemon-reload
$ systemctl restart docker

$ docker info | grep -i proxy

socks 配置方式

1
2
[Service]
Environment="ALL_PROXY=socks5h://localhost:1080"