繁体   English   中英

Docker无法使用代理连接到Internet

[英]Docker can't connect to the internet from with proxy

我有这个Linux盒子

$ uname -a
Linux TOCWgfi7IC 2.6.32-504.el6.x86_64 #1 SMP Tue Sep 16 01:56:35 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

我有docker在上面运行(有人为我安装了它,但是似乎/ etc / default / docker这样的配置文件不存在)

我使用代理HTTP和https。
我已经将代理设置添加到.bashrc文件和.bash_profile中,并且能够使用github进行拉取。 我还添加了HTTP_PROXY和小写版本(http_proxy)到/etc/default/docker、/etc/environment、/etc/apt/apt.conf、/etc/bash.bashrc以及其他可能的文件中)

我的代理人采用以下格式:

http_proxy=http://proxyprd.sss.com:8080
https_proxy=https://proxyprd.sss.com:8080

如果我使用wget,我什么也收不到。 请求超时。

sudo wget https://index.docker.io/v1
--2015-07-07 13:13:33--  https://index.docker.io/v1
Resolving index.docker.io... 54.174.141.60, 54.210.36.116, 54.152.41.71
Connecting to index.docker.io|54.174.141.60|:443...
failed: Connection timed out.

我查看了docker文档和一些SO问题,但没有一个问题为我解决了:
在Ubuntu中将代理与wget一起使用的问题

https://docs.docker.com/articles/systemd/#http-proxy

无法在代理后面下载Docker映像

如何使用docker连接到互联网。 代理行中是否需要用户名和密码?

编辑1
通过添加/root/.wgetrc并将代理放置在其中,wget可以工作。
这不适用于使用/root/.dockerrc的docker :(

这个问题尚未得到解答很长时间,但可能会对其他人有所帮助。

docker build --build-arg http_proxy=http://host:port --build-arg https_proxy=https://host:port -t dwp_service:0.1 dwp_services/

只要在构建映像时将代理作为构建参数传递就可以了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM