will
will

Reputation: 101

docker no_ Proxy does not take effect

i want skip registry.cn-shenzhen.aliyuncs.com use proxy

[root@localhost ~]# docker login [email protected] registry.cn-shenzhen.aliyuncs.com
Password: 
Error response from daemon: Get "https://registry.cn-shenzhen.aliyuncs.com/v2/": proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused

i have already config no_proxy,but it still use proxy

[root@localhost ~]# systemctl show --property=Environment docker
Environment=HTTP_PROXY=socket5://127.0.0.1:7890 HTTPS_PROXY=http://127.0.0.1:7890 NO_PROXY=localhost,127.0.0.1,192.168.93.0,*.registry.cn-shenzhen.aliyuncs.com

anyone can help?

Upvotes: 1

Views: 2782

Answers (1)

atline
atline

Reputation: 31584

registry.cn-shenzhen.aliyuncs.com is just frontend url facing to user I think, there are some other sites which will use during the whole process, something like next:

Error response from daemon: Get https://registry.cn-shenzhen.aliyuncs.com/v2/: Get https://dockerauth.cn-hangzhou.aliyuncs.com/auth?account=xxx%40outlook.com&client_id=docker&offline_token=true&service=registry.aliyuncs.com%3Acn-shenzhen%3A26842: proxyconnect tcp: dial tcp: lookup proxy.example.com: no such host

We could see there are also dockerauth.cn-hangzhou.aliyuncs.com involved.

As a result, set NO_PROXY as *.aliyuncs.com, reload & restart docker could match all websites:

$ cat /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:8080/"
Environment="HTTPS_PROXY=http://proxy.example.com:8080/"
Environment="NO_PROXY=*.aliyuncs.com"

Upvotes: 1

Related Questions