Ubuntu16.04设置Docker代理

我们在Ubuntu16.04上面安装完Docker(http://blog.csdn.net/dylloveyou/article/details/78233280)后,如果我们主机配置了代理,而没有单独给Docker设置代理,则去Docker Hub查询镜像时会报如下错误:

root@docker02:~# docker search ubuntu
Error response from daemon: Get https://index.docker.io/v1/search?q=ubuntu&n=25: dial tcp 34.234.103.99:443: i/o timeout

设置代理方法如下:

创建配置文件/etc/systemd/system/docker.service.d/http-proxy.conf,添加如下配置:

[Service]
Environment=”HTTP_PROXY=http://ip:port/
Environment=”HTTPS_PROXY=http://ip:port/

重启

systemctl daemon-reload
systemctl restart docker

再次执行docker search 就可以了

root@docker02:~# docker search ubuntu
NAME                                                   DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
ubuntu                                                 Ubuntu is a Debian-based Linux operating s...   6745      [OK]       
dorowu/ubuntu-desktop-lxde-vnc                         Ubuntu with openssh-server and NoVNC            141                  [OK]
rastasheep/ubuntu-sshd                                 Dockerized SSH service, built on top of of...   113                  [OK]
ansible/ubuntu14.04-ansible                            Ubuntu 14.04 LTS with ansible                   88                   [OK]
ubuntu-upstart                                         Upstart is an event-based replacement for ...   80        [OK]       
neurodebian                                            NeuroDebian provides neuroscience research...   40        [OK]       
ubuntu-debootstrap                                     debootstrap --variant=minbase --components...   31        [OK]       
nuagebec/ubuntu                                        Simple always updated Ubuntu docker images...   22                   [OK]
tutum/ubuntu                                           Simple Ubuntu docker images with SSH access     19                   
1and1internet/ubuntu-16-nginx-php-phpmyadmin-mysql-5   ubuntu-16-nginx-php-phpmyadmin-mysql-5          16                   [OK]

需要注意,ubuntu16.04的Docker代理设置方式和ubuntu14.04不一样,ubuntu14.04请参考http://blog.csdn.net/dylloveyou/article/details/53582596

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值