Docker 设置proxy

不同的版本应对的处理方法不一样. 

Ubuntu 14.04 LTS

For Ubuntu 14.04 LTS who uses SysVinit, you should modify /etc/default/docker file:

# cat /etc/default/docker
# Docker Upstart and SysVinit configuration file

#
# THIS FILE DOES NOT APPLY TO SYSTEMD
#
#   Please see the documentation for "systemd drop-ins":
#   https://docs.docker.com/engine/articles/systemd/
#

.......
# If you need Docker to use an HTTP proxy, it can also be specified here.
export http_proxy="http://web-proxy.corp.xxxxxx.com:8080/"
export https_proxy="https://web-proxy.corp.xxxxxx.com:8080/"
......

Then restart docker:

service docker restart

============================================

Ubuntu 16.04 LTS

For Ubuntu 16.04 LTS who uses Systemd, you can follow this post:

(1) Create a systemd drop-in directory:

mkdir /etc/systemd/system/docker.service.d

(2) Add proxy in /etc/systemd/system/docker.service.d/http-proxy.conf file:

# cat /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=https://username:password@web-proxy.corp.xxxxxx.com:8080/"
Environment="HTTPS_PROXY=https://username:password@web-proxy.corp.xxxxxx.com:8080/"
Environment="NO_PROXY=localhost,127.0.0.1,localaddress,.localdomain.com"

(3) Flush changes:

systemctl daemon-reload

(4) Restart Docker:

systemctl restart docker
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值