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/

 

posted on 2019-01-07 12:38  Netsharp  阅读(5808)  评论(0编辑  收藏  举报

导航