docker - CentOS 6.7 在防火墙后与 Docker 的连接问题

标签 docker centos connection-timeout

请忽略我在链接和 URL 中的错误空格。我没有发布 > 2 个网址或 2 个链接所需的声誉。

我有一个新安装的 CentOS 6.7,如下面的 uname -a 命令所示:

Linux 2.6.32-573.7.1.el6.x86_64 #1 SMP 2015 年 9 月 22 日星期二 22:00:00 UTC x86_64 x86_64 x86_64 GNU/Linux

这台机器位于公司防火墙后面。

我已经安装了 docker-io。版本信息为(docker版本):

客户端版本:1.7.1
客户端 API 版本:1.19
Go 版本(客户端):go1.4.2
Git 提交(客户端):786b29d/1.7.1
操作系统/Arch(客户端):linux/amd64
服务器版本:1.7.1
服务器 API 版本:1.19
Go 版本(服务器):go1.4.2
Git 提交(服务器):786b29d/1.7.1
操作系统/Arch(服务器):linux/amd64

docker 服务正在运行:

docker (pid 2593)正在运行...

当我跑
sudo docker pull hello-world
我得到错误:
获取 https ://index.docker.io/v1/repositories/library/hello-world/images: dial tcp 54.165.23.153:443: connection timed out

当我跑
sudo docker run hello-world
我收到类似的错误:
获取 https ://index.docker.io/v1/repositories/library/hello-world/images: dial tcp 52.7.162.45:443: connection timed out

我可以浏览到 URL
https ://index.docker.io/v1/repositories/library/hello-world/images 在 Firefox 中(在我输入代理的用户名/密码之后)。我得到:

[{"checksum": "", "id": "3f12c794407e68e515ba7f473a744e748ac8a827a2ea8b33855dec564238b2e5"}, {"checksum": "", "id": "975b84d108f1024953937167506c2935a081c8c55ae9e9f7b7deee118605367f"}, {"checksum": "", "id": "535020c3e8add9d6bb06e5ac15a261e73d9b213d62fb2c14d752b8e189b2b912"}, {"checksum": "", "id": "af340544ed62de0680f441c71fa1a80cb084678fed42bae393e543faea3a572c"}, {"checksum": "", "id": "a8219747be10611d65b7c693f48e7222c0bf54b5df8467d3f99003611afa1fd8"}, {"checksum": "", "id": "91c95931e552b11604fea91c2f537284149ec32fff0f700a4769cfd31d7696ae "}, {"checksum": "", "id": "e45a5af57b00862e5ef5782a9925979a02ba2b12dff832fd0991335f4a11e5c5"}, {"checksum": "", "id": "31cbccb51277105ba3ae35ce33c22b69c9e3f1002e76e4c736a2e8ebff9d7b5d"}, {"checksum": "", "id": "ef872312fe1bbc5e05aae626791a47ee9b032efa8f3bda39cc0be7b56bfe59b9"}, {"checksum": "", "id": "7fa0dcdc88de9c8a856f648c1f8e0cf8141a505bbddb7ecc0c61f1ed5e086852"}, {"checksum": "", "id": "bf16b6e27882c0790071c95326e0186eccd2b8ac2bd5ef34fecdbb3 32a90926e"}, {"checksum": "", "id": "8f5550346e6173730dca712d1fc87e671ae04d5899d6c4290f7897c054b2318e"}, {"checksum": "", "id": "f86750113cd23609d504342d39015d5c7f218935b8420dd43b79cd99f4f93960"}, {"checksum": "", "id": "0a1b1cfaa9a2153fdabe163d562fe1321a5c1d1db3a59e0fac7c65f966bc38a9"}, {"checksum": "", "id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158"}, {"checksum": "", "id": "2505d942a91db2045278f9d5c58067414d367c02506bbba96f0769a6ac6ad47b"}, {"checksum": "", "id":“565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1”}]

curl www.google.com 和 curl http://www.google.com正常工作。

当我运行时:
curl -v https://index.docker.io:443

我得到以下信息:
* 即将 connect() 到 index.docker.io 端口 443 (#0)
* 尝试 54.165.23.153... 连接超时
* 尝试 54.84.122.145... 连接超时
* 尝试 52.7.162.45... 连接超时
* 无法连接到主机
* 关闭连接 #0
curl: (7) 无法连接到主机

根据 Stack Overflow 上的另一篇文章,我已经在/etc/default/docker 文件中尝试了使用和不使用 http_proxy 和 https_proxy 信息的 docker run 和 docker pull。最初,在 docker-io 安装后没有可用的/etc/default/docker 文件。这没有帮助。
/etc/default/docker 文件的内容如下所示:
http_proxy=http ://代理名称:端口
https_proxy=http ://代理名称:端口

我也试过(在/etc/default/docker 文件中):
导出 http_proxy=http ://proxyName:port
导出 https_proxy=http ://proxyName:port

我今天整天都在谷歌上搜索以解决这个问题,但没有取得任何进展。

最佳答案

您的问题是您的公司防火墙。这可能无法解决,因为您的公司要求您使用用户名和密码登录 - 您可以使用 firefox 下载图像,我想它正在使用 LDAP 或其他方式为您协商代理。

您可以尝试在 shell 中设置 http_proxy 和 https_proxy 变量,这可能取决于代理

$ export http_proxy=http://server-ip:port/
$ export http_proxy=http://127.0.0.1:3128/
$ export http_proxy=http://proxy-server.mycorp.com:3128/

http://www.cyberciti.biz/faq/linux-unix-set-proxy-environment-variable/

您的公司可能正在尽量减少任何行为不良的代码进入他们的网络,因此您可能不应该规避这一点并与您的 IT 部门交谈

关于docker - CentOS 6.7 在防火墙后与 Docker 的连接问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33400645/

相关文章:

docker - Docker数据卷和挂载到主机

java - 用于从 oracle 社区获取最新 Oracle jre 的 REST API 是什么

linux - 如何在CentOS 关机时弹出消息窗口?

node.js - Docker CentOS 镜像 NodeJS

Docker 基础知识,如何保存已安装的包和编辑过的文件?

python - CentOS 上 pip 包管理器的问题

linux-kernel - 奇怪的内核错误 - 无法 Yum 更新

.net - 拔掉网线时 SQL 连接不会很快超时

javascript - 多次成功请求后连接超时 jQuery.ajax

Node.js 服务器超时问题(EC2 + Express + PM2)