我们希望在我们的项目中加入 docker,但我遇到了一些困难。
我通过此处的说明安装了 Docker:https ://docs.docker.com/engine/installation/linux/rhel/并且没有问题。但是,当我尝试从 docker hub 拉取任何图像时,它只是挂起并且什么也没有发生:
┌─[user@hostname]─(~)
└─[11:53]$ docker pull alpine:latest
这是我的 docker 版本信息:
┌─[user@hostname]─(~)
└─[11:53]$ docker version
Client:
Version: 1.11.2
API version: 1.23
Go version: go1.5.4
Git commit: b9f10c9
Built: Wed Jun 1 21:23:11 2016
OS/Arch: linux/amd64
Server:
Version: 1.11.2
API version: 1.23
Go version: go1.5.4
Git commit: b9f10c9
Built: Wed Jun 1 21:23:11 2016
OS/Arch: linux/amd64
这是 VPC 中的一个 redhat 7.2 实例。我正在使用另一个 rhel 7.2 实例通过 iptables 处理 NAT。这个问题是我遇到的第一个连接问题。
我在其他地方读到,指定一个 http 代理可以解决这个问题,所以我在我的 nat 服务器上设置了一个 squid 代理,但无济于事。我按照此处的说明设置 docker 使用的代理:https ://docs.docker.com/engine/admin/systemd/#/http-proxy
代理正在获取请求,但 docker 仍然无法提取任何图像。这是我的鱿鱼日志的输出:
1467475616.376 110 10.0.0.50 TCP_MISS/200 3250 CONNECT registry-1.docker.io:443 - HIER_DIRECT/52.71.80.248 -
1467475616.415 35 10.0.0.50 TCP_MISS/200 4444 CONNECT auth.docker.io:443 - HIER_DIRECT/52.204.167.32 -
我没有东西可以在这里尝试了。任何帮助将不胜感激。
编辑
出现新错误!调整 squid 代理配置后,我现在在尝试拉取图像时收到此错误:
┌─[user@hostname]─(~)
└─[15:15]$ sudo docker pull alpine
Using default tag: latest
Pulling repository docker.io/library/alpine
Error while pulling image: Get https://index.docker.io/v1/repositories/library/alpine/images: Service Unavailable
这是 ping 的输出:
┌─[user@hostname]─(~)
└─[15:15]$ ping index.docker.io
PING us-east-1-elbio-rm5bon1qaeo4-623296237.us-east-1.elb.amazonaws.com (54.173.200.203) 56(84) bytes of data.
^C
--- us-east-1-elbio-rm5bon1qaeo4-623296237.us-east-1.elb.amazonaws.com ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 1999ms
而 wget 可以从 docker 错误信息中的 url 下载一个 json 文件:
┌─[user@hostname]─(~)
└─[15:17]$ wget https://index.docker.io/v1/repositories/library/alpine/images
--2016-07-02 15:17:20-- https://index.docker.io/v1/repositories/library/alpine/images
Resolving index.docker.io (index.docker.io)... 54.173.200.203, 52.22.190.106, 52.203.138.237
Connecting to index.docker.io (index.docker.io)|54.173.200.203|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/json]
Saving to: ‘images’
[ <=> ] 6,900 --.-K/s in 0s
2016-07-02 15:17:20 (185 MB/s) - ‘images’ saved [6900]