Home >Operation and Maintenance >Docker >How to set up HTTP proxy in docker
The method for docker to set HTTP proxy is as follows:
1. Comment out the nameserver configuration
[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
and change it to:
[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
2. Agent configuration
mkdir -p /etc/systemd/system/docker.service.dvi /etc/systemd/system/docker.service.d/http-proxy.conf
Specific configuration content
[Service] Environment="HTTP_PROXY=http://xx.xx.xx.xx:80/
3. Restart docker
systemctl daemon-reload systemctl restart docker
4. View the configuration results
systemctl show --property=Environment docker
If the following output appears, configure Success
Environment=HTTP_PROXY=http://x.xx.xx.xx:80/
Recommended tutorial: docker tutorial
The above is the detailed content of How to set up HTTP proxy in docker. For more information, please follow other related articles on the PHP Chinese website!