配置Docker代理已实现外网访问

版本:

OS: CentOS 7.4

Docker: 17.09

 

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:password@172.16.3.139:3128"

 

2.For HTTPS proxy server:

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

   [Service]
     Environment="HTTPS_PROXY=http://username:password@172.16.3.139: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

 

posted @ 2018-04-25 09:47  2240930501  阅读(4721)  评论(0编辑  收藏  举报