如何解决Docker"错误拉图像...太多重定向"从注册表中提取图像时失败?

时间:2014-06-05 12:20:57

标签: macos docker coreos

我在OS X 10.10上通过CoreOS和Vagrant运行Docker。

当我在CoreOS中运行docker pull ubuntu时,出现以下错误:

$ docker pull ubuntu
Pulling repository ubuntu
cc0067db4f11: Error pulling image (precise) from ubuntu, endpoint: https://cdn-registry-1.docker.io/v1/, Get https://cdn-registry-1.docker.io/v1/images/cc0067db4f11198ef6fd0435f96a973e559b1cebfceb2bc8e4fe527b32045c2f/ancestry: dial tcp: lookup cdn-registry-1.dcc0067db4f11: Error pulling image (precise) from ubuntu, Get https://cdn-registry-1.docker.io/v1/images/cc0067db4f11198ef6fd0435f96a973e559b1cebfceb2bc8e4fe527b32045c2f/ancestry: dial tcp: lookup cdn-registry-1.docker.io on [10.0.2.3]:53: too many redirects 
6006e6343fad: Error pulling image (quantal) from ubuntu, endpoint: https://cdn-registry-1.docker.io/v1/, Get https://cdn-registry-1.docker.io/v1/images/6006e6343fadaaeb5dd98436a3cd17eac8c03cabca1ed4c8778d039e72ebcc9c/ancestry: dial tcp: lookup cdn-registry-1.d6006e6343fad: Error pulling image (quantal) from ubuntu, Get https://cdn-registry-1.docker.io/v1/images/6006e6343fadaaeb5dd98436a3cd17eac8c03cabca1ed4c8778d039e72ebcc9c/ancestry: dial tcp: lookup cdn-registry-1.docker.io on [10.0.2.3]:53: too many redirects 
7656cbf56a8c: Error pulling image (13.04) from ubuntu, endpoint: https://cdn-registry-1.docker.io/v1/, Get https://cdn-registry-1.docker.io/v1/images/7656cbf56a8c831de71ef43809b04fcf8125e7b039250835b6c5f6f280daf12e/ancestry: dial tcp: lookup cdn-registry-1.doc7656cbf56a8c: Error pulling image (13.04) from ubuntu, Get https://cdn-registry-1.docker.io/v1/images/7656cbf56a8c831de71ef43809b04fcf8125e7b039250835b6c5f6f280daf12e/ancestry: dial tcp: lookup cdn-registry-1.docker.io on [10.0.2.3]:53: too many redirects 
3db9c44f4520: Error pulling image (lucid) from ubuntu, endpoint: https://cdn-registry-1.docker.io/v1/, Get https://cdn-registry-1.docker.io/v1/images/3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710/ancestry: dial tcp: lookup cdn-registry-1.doc3db9c44f4520: Error pulling image (lucid) from ubuntu, Get https://cdn-registry-1.docker.io/v1/images/3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710/ancestry: dial tcp: lookup cdn-registry-1.docker.io on [10.0.2.3]:53: too many redirects 
5cf8fd909c6c: Error pulling image (trusty) from ubuntu, endpoint: https://cdn-registry-1.docker.io/v1/, Get https://cdn-registry-1.docker.io/v1/images/5cf8fd909c6ccc61199df6dbeb165767b83c23842ef49ca3ef3b81ece1bdce4f/ancestry: dial tcp: lookup cdn-registry-1.do5cf8fd909c6c: Error pulling image (trusty) from ubuntu, Get https://cdn-registry-1.docker.io/v1/images/5cf8fd909c6ccc61199df6dbeb165767b83c23842ef49ca3ef3b81ece1bdce4f/ancestry: dial tcp: lookup cdn-registry-1.docker.io on [10.0.2.3]:53: too many redirects 
d2099a5ba6c5: Error pulling image (saucy) from ubuntu, endpoint: https://cdn-registry-1.docker.io/v1/, Get https://cdn-registry-1.docker.io/v1/images/d2099a5ba6c5a0f94f84162d69b4cb79b47c7ea1768550c6cee55a7ba2dc3647/ancestry: dial tcp: lookup cdn-registry-1.docd2099a5ba6c5: Error pulling image (saucy) from ubuntu, Get https://cdn-registry-1.docker.io/v1/images/d2099a5ba6c5a0f94f84162d69b4cb79b47c7ea1768550c6cee55a7ba2dc3647/ancestry: dial tcp: lookup cdn-registry-1.docker.io on [10.0.2.3]:53: too many redirects 
2014/06/05 12:17:11 Could not find repository on any of the indexed registries.

如果有人能就如何解决这个问题给我一个有用的建议,我真的很感激。

6 个答案:

答案 0 :(得分:49)

尝试此临时解决方法:

osx$ boot2docker up
osx$ boot2docker ssh
docker@boot2docker$ sudo echo "nameserver 8.8.8.8" > /etc/resolv.conf
docker@boot2docker$ sudo /etc/init.d/docker restart

直到重启才有效。

答案 1 :(得分:4)

我不了解OS X,但是在Linux上这可能是由于"坏" /etc/resolv.conf在主机上。例如,ubuntu就像这样:

nameserver 127.0.1.1

然后通过某些服务处理DNS请求。问题是,这可以从图像内部访问。

要解决此问题,我必须添加一些外部名称服务器,例如:

nameserver 127.0.1.1
nameserver 8.8.8.8
nameserver 8.8.4.4

答案 2 :(得分:3)

尝试使用此命令从docker存储库中取出容器时遇到类似问题:
docker pull ubuntu

请注意,我在virtualbox中使用了coreos,我使用Nat作为我的网络配置来访问互联网。使用virtualbox切换网络模式时,我无法做任何拉动。

我通过使用 systemctl 重新启动docker来解决此问题: sudo systemctl restart docker

然后我的拉动工作正常。我希望这个解决方案能帮到你。我是通过以下链接从CoreOS创作者之一( Brandon Philips )处理的Google群组问题中获得的: https://groups.google.com/forum/#!topic/coreos-dev/vWqSbPgNYro

答案 3 :(得分:3)

10.0.2.3是virtualbox dns服务器,请检查Fine-tuning the VirtualBox NAT engine

您可以像其他人一样建议使用谷歌DNS服务器8.8.8.8

# /etc/resolve.conf
nameserver 8.8.8.8

如果您在Intranet中工作,请将其替换为普通的DNS服务器,您可以添加search,如下所示

# /etc/resolve.conf
nameserver xxx.xxxx.xxx
search company.com

这样可以访问您的私人仓库

答案 4 :(得分:0)

在MacOSX上,如果您使用Docker Machine,您可以尝试:

 docker-machine ls
 docker-machine ssh YOUR_VM_NAME

然后从VM内部: 杀死/ usr / local / bin / docker进程并再次手动启动它:

 sudo /usr/local/bin/docker -d -D -g /var/lib/docker -H unix:// -H tcp://0.0.0.0:2376 --label provider=virtualbox --tlsverify --tlscacert=/var/lib/boot2docker/ca.pem --tlscert=/var/lib/boot2docker/server.pem --tlskey=/var/lib/boot2docker/server-key.pem -s aufs

有趣的是,像这样重新启动

sudo /etc/init.d/docker restart

无济于事。

答案 5 :(得分:0)

在Windows上,我可以通过执行以下操作来修复它:

  1. 转到虚拟框应用程序
  2. 删除已创建的VM
  3. 重新启动计算机(我认为是可选的)
  4. 启动Kitematic
  5. 返回Virtual Box,点击show
  6. 确保ping google.com命令正常工作
  7. 现在我可以从集线器下载泊坞窗图像了。