Configure Docker proxy to achieve external network access

For setting up proxy for docker, please do the following:


1.Create a systemd drop-in directory for the docker service:

#mkdir -p /etc/systemd/system/docker.service.d
 #vim /etc/systemd/system/docker.service.d/http-proxy.conf
   
    [Service]
      Environment="HTTP_PROXY=http://username:[email protected]:3128"

 

2.For HTTPS proxy server:

#vim /etc/systemd/system/docker.service.d/https-proxy.conf

   [Service]
     Environment="HTTPS_PROXY=http://username:[email protected]:3128"

 

3.Flush changes execute: 

#systemctl daemon-reload

 

4.Restart Docker:

#systemctl restart docker 

 

5.Verify that the configuration has been loaded: 

#systemctl show --property=Environment docker

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324889836&siteId=291194637