How to fix Docker's "Error pulling image...too many redirects" failures while pulling images from registry?
Asked Answered
P

6

28

I am running Docker via CoreOS and Vagrant on OS X 10.10.

When I run docker pull ubuntu in CoreOS, I got following errors:

$ 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.

I'd really appreciate if anyone could give me a useful advise on how to troubleshoot this problem.

Polysyllable answered 5/6, 2014 at 12:20 Comment(1)
I've submitted a bug report to Virtualbox: virtualbox.org/ticket/13104Lannielanning
P
50

Try this temporary workaround:

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

It works until reboot.

Polluted answered 12/7, 2014 at 7:5 Comment(6)
A short explanation why this solve the problem would be helpful.Gearwheel
This answer doesn't address that the original question was involving a different Linux distro.Porett
@SidBurn et al., this works by using Google's public DNS (8.8.8.8) to resolve domain names to IP addresses. Something is wrong with the nameserver that boot2docker is trying to use by default. This answer doesn't speak to why the nameserver boot2docker wants to use is busted; it bandaids the issue by using DNS that works.Fissirostral
Works for coreos with Vagrant tooProsaism
Works also if you're using docker-machine, just replace boot2docker above with docker-machine.Meadowlark
This should not be the accepted answer. Why do you need a workaround ?Hadwin
A
4

I don't know about OS X, but on linux this could happen due to "bad" /etc/resolv.conf on the host. For example, ubuntu puts something like:

nameserver 127.0.1.1

and then handles the DNS requests through some service. The problem is, that this is accessible from inside of the image.

To fix this, I had to add some external nameservers, like:

nameserver 127.0.1.1
nameserver 8.8.8.8
nameserver 8.8.4.4
Aerobatics answered 5/6, 2014 at 14:31 Comment(2)
I thought like that too however it seems to be not the case, changing resolve.conf doesn't help. What is the tool that you use to dig up more details where the request is redirect/bounced back?Medicament
Well, I'm new to docker, so I mainly use google :) In my case, it the container failed to resolve archive.ubuntu.com (or some such), but it was resolving fine from the host. So I looked at /etc/resolv.conf in the container and saw what I described in the answer.Aerobatics
A
4

10.0.2.3 is virtualbox dns server, check Fine-tuning the VirtualBox NAT engine

You can as other suggested use 8.8.8.8 which is google dns server.

# /etc/resolve.conf
nameserver 8.8.8.8

And if you work in intranet, then replace it with your normal dns server, which you can add search as well like below

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

This will be good to access your private repo

Accountant answered 22/8, 2014 at 8:52 Comment(0)
H
3

I had a similar issue when trying to pull a container from docker repository with this command :
docker pull ubuntu

Note that I was using coreos inside virtualbox and I was using Nat as my Networking Configuration to have access to internet. When Switching network modes with virtualbox, I couldn't do any pull.

I solved the issue by restarting docker with systemctl by iniating this command :
sudo systemctl restart docker

And then my pull worked fine. I hope this solution helped you. And I got it from from google group issue addressed by one of CoreOS creators(Brandon Philips) through this link: https://groups.google.com/forum/#!topic/coreos-dev/vWqSbPgNYro

Hygienist answered 21/8, 2014 at 13:37 Comment(1)
sudo services docker.io restart help me solve Could not find repository on any of the indexed registries. on Ubuntu 14.04Privity
S
0

On MacOSX, if you use Docker Machine you can try to:

 docker-machine ls
 docker-machine ssh YOUR_VM_NAME

and then from within the VM: kill the /usr/local/bin/docker process and start it again by hand:

 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

Funnily enough, restarting like this

sudo /etc/init.d/docker restart

does not help.

Skywriting answered 17/11, 2015 at 17:25 Comment(1)
For me, simply stopping and restarting the docker-machine seemed to help.Reorientation
M
0

On windows I was able to fix it by doing the following:

  1. Go to virtual box application
  2. Delete the VM that was created
  3. Restart computer (optional, i think)
  4. Start Kitematic
  5. Go back to Virtual Box, hit show
  6. Make sure ping google.com command works

Now I am able to download docker images from the hub.

Missal answered 2/4, 2016 at 11:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.