docker设置HTTP代理的方法如下:
一、注释掉nameserver的配置
[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.dvi /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/
推荐教程:docker教程