Docker设置HTTP代理

参考资料:为docker配置HTTP代理服务器

一、注释掉namesserver的配置

[root@nvwa ~]# cat /etc/resolv.conf
# Generated by NetworkManager
search apa.gad.schneider-electric.com
nameserver xx.xx.xx.xx
nameserver xx.xx.xx.xx

改为:

[root@nvwa ~]# cat /etc/resolv.conf
# Generated by NetworkManager
#search apa.gad.schneider-electric.com
#nameserver xx.xx.xx.xx
#nameserver xx.xx.xx.xx

二、 代理配置

mkdir -p /etc/systemd/system/docker.service.d
vi /etc/systemd/system/docker.service.d/http-proxy.conf

具体配置内容

[Service]
Environment="HTTP_PROXY=http://xx.xx.xx.xx:80/

三、重启docker

systemctl daemon-reload
systemctl restart docker

四、查看配置结果

systemctl show --property=Environment docker

如果出现如下输出则配置成功

Environment=HTTP_PROXY=http://x.xx.xx.xx:80/

 

转载于:https://www.cnblogs.com/Netsharp/p/10232580.html

你可能感兴趣的:(java)