首頁  >  文章  >  運維  >  docker如何設定HTTP代理

docker如何設定HTTP代理

王林
王林原創
2020-05-19 13:14:123562瀏覽

docker如何設定HTTP代理

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教學

以上是docker如何設定HTTP代理的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn