【发布时间】:2015-07-07 17:23:41
【问题描述】:
我有这个 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 问题,但没有一个为我解决了这个问题:
Problem of using proxy with wget in Ubuntu
https://docs.docker.com/articles/systemd/#http-proxy
Cannot download Docker images behind a proxy
如何使用 docker 连接到互联网。我需要在代理行中输入用户名和密码吗?
编辑 1
通过添加 /root/.wgetrc 并将代理放入其中,让 wget 工作。
这不适用于带有 /root/.dockerrc 的 docker :(
【问题讨论】:
-
你有代理连接吗?例如。
telnet proxyprd.sss.com 8080. -
不确定您所说的连接是什么意思...这些是代理的网址:
http_proxy=http://proxyprd.sss.com:8080和https_proxy=https://proxyprd.sss.com:8080 -
为了使用代理,您必须能够连接到它。您可以使用命令
telnet proxyprd.sss.com 8080进行测试。 -
@user3584460 是的,我可以连接。我遇到了 wget 超时但 curl 有效的问题。然后我将 2 个代理添加到 /root/.wgetrc 并且它起作用了。我尝试使用代理制作 /root/.dockerrc 文件,但没有成功
标签: linux docker wget http-proxy