Home >Operation and Maintenance >Docker >How to set up HTTP proxy in docker

How to set up HTTP proxy in docker

王林
王林Original
2020-05-19 13:14:123672browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn