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

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.

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.

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

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

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

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.

On windows I was able to fix it by doing the following:
Go to virtual box application
Delete the VM that was created
Restart computer (optional, i think)
Start Kitematic
Go back to Virtual Box, hit show
Make sure ping google.com command works
Now I am able to download docker images from the hub.

Related

Error: initializing source docker://ibmcom/mq:latest: pinging container registry registry-1.docker.io .... connection refused

I am using Linux and trying to simulate a ibm mq server by myself via podman, however i got issue in podman run. I have added the docker.io to localhost in /etc/hosts. however i still got this issue, does someone know what i am missing here?
Thank you in advance.
Calling podman run to start the server in container [ibm_mqserver] public port is [51672] ...
Trying to pull docker.io/ibmcom/mq:latest...
Error: initializing source docker://ibmcom/mq:latest: pinging container registry registry-1.docker.io: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:62268->[::1]:53: read: connection refused
below is the error screenshot
Podman Run Error screenshot
As of writing the location for the latest MQ image is icr.io/ibm-messaging/mq:latest

cURL error 28: Failed to connect to systemb port 80: Timed out for http://systemb/api/push_products [duplicate]

This question shows research effort; it is useful and clear
I have checked the cURL not working properly
When I run the command curl -I https://www.example.com/sitemap.xml
curl: (7) Failed to connect
Failed to connect on all port
this error only on one domain, all other domain working fine, curl: (7) Failed to connect to port 80, and 443
Thanks...
First Check your /etc/hosts file entries, may be the URL which You're requesting, is pointing to your localhost.
If the URL is not listed in your /etc/hosts file, then try to execute following command to understand the flow of Curl Execution for the particular URL:
curl --ipv4 -v "https://example.com/";
After many search, I found that Hosts settings not correct
Then I check nano /etc/hosts
The Domain point to wrong IP in hosts file
I change the wrong IP and its working Fine
This is new error Related to curl: (7) Failed to connect
curl: (7) Failed to connect
The above error message means that your web-server (at least the one specified with curl) is not running at all — no web-server is running on the specified port and the specified (or implied) port. (So, XML doesn't have anything to do with that.)
you can download the key with browser
then open terminal in downloads
then type sudo apt-key add <key_name>.asc
Mine is Red Hat Enterprise(RHEL) Virtual Machine and I was getting something like the following.
Error "curl: (7) Failed to connect to localhost port 80: Connection refused"
I stopped the firewall by running the following commands and it started working.
sudo systemctl stop firewalld
sudo systemctl disable firewalld
If the curl is to the outside world, like:
curl www.google.com
I have to restart my cntlm service:
systemctl restart cntlm
If it's within my network:
curl inside.server.local
Then a docker network is overlapping something with my CNTLM proxy, and I just remove all docker networks to fix it - you can also just remove the last network you just created, but I'm lazy.
docker network rm $(docker network ls -q)
And then I can work again.

Connection refused from host into a linux container with Docker for Windows

I found a lot of material on this issue online, however I wasn't able to find a solution. Also majority of them are rather old (a few years) and things could have considerably changed meanwhile.
I have Docker Desktop Community v 2.3.0.3 running on my Windows machine and a simple container with Ubuntu and a Rails app running on localhost:5000 inside.
The container gets run using:
docker run -p 5000:5000 rails:6.0.3 foreman start
I would like to connect to the Rails app from my Windows host machine via browser, but connection gets refused.
The server is up and running:
> docker exec 3c167e206f60 wget localhost:5000
--2020-06-06 08:21:26-- http://localhost:5000/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:5000... connected.
HTTP request sent, awaiting response... 200 OK
Port forwarding doesn't seem to work correctly (run from WSL, but similarly from Windows via Chrome):
> wget localhost:5000
--2020-06-06 10:22:50-- http://localhost:5000/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:5000... failed: Connection refused.
It doesn't work when using container address instead of localhost, either:
> docker inspect --format '{{ .NetworkSettings.IPAddress }}' 3c167e206f60
172.17.0.2
> wget 172.17.0.2:5000
--2020-06-06 10:29:02-- http://172.17.0.2:5000/
Connecting to 172.17.0.2:5000... failed: Resource temporarily unavailable.
Also (as probably expected), I don't see any docker related entry in ifconfig (from WSL) or ipconfig (from Windows) output.
I also tried docker run --net host parameter, which didn't help either.
I would ideally prefer a solution which doesn't require me to modify the Windows host setup (network setup, etc), to avoid the possibility of breaking other scenarios.
I've been struggling with this issue for several days. What worked for me was to:
Uninstall Docker Desktop
Turn off the Hyper-V, Virtual Machine Platform, and Windows Hypervisor Platform via the Turn Windows Features On and Off control panel module
Reboot
Turn on all features in #2
Re-install Docker Desktop
This seems to reset all of the HyperV virtual networking interfaces. It's possible that uninstalling Docker Desktop isn't necessary but since it relies on at least some of these features I felt it wisest to do a complete cycle.

Timeout when pulling any image in docker (local issue: gateway.docker.internal)

[Problem]
I am getting the following error using any pull command (docker pull bash:latest):
Error response from daemon: Get https://registry-1.docker.io/v2/: proxyconnect tcp: dial tcp: lookup gateway.docker.internal on 192.168.65.1:53: read udp 192.168.65.3:38813->192.168.65.1:53: i/o timeout
Started happening randomly yesterday. Cannot give any more useful info than this, because I don't have any.
[Solutions I have tried]
I have added the host 127.0.0.1 for gateway.docker.internal and for host.docker.internal in /etc/hosts/.
I have reinstalled the docker.
I have used different dns servers (8.8.8.8 and 8.8.4.4). Both in /etc/resolv.conf and by setting them in the Docker GUI settings.
I have even reinstalled the MacOS (via command + R).
Nothing is fixing this issue. Would be really good to get an input from someone. I have wasted two days on this, and no progress.
[Note]
The only thing that gives me a different error, is when I use the subnet in GUI docker that is copied from docker network inspect bridge. If I do so, I get the connection refused error postfix instead of the time out.
I really don't know much about networks, please do let me know if there are any other details you might be interested in.
I had the same issue:
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: proxyconnect tcp: dial tcp: lookup gateway.docker.internal on 192.168.65.1:53: read udp 192.168.65.3:58231->192.168.65.1:53: i/o timeout.
See 'docker run --help'.
In my case I had to stop the company Antivirus/firewall agent. It started working afterwards.

Can't pull docker image: no route to host

When using boot2docker on OSX, I can't pull a new image from Docker Hub:
$ docker run mysql
Unable to find image 'mysql' locally
Pulling repository mysql
2014/06/24 16:58:18 Get https://index.docker.io/v1/repositories/mysql/images: dial tcp: read udp 192.168.0.1:53: no route to host
I can still access that URL using a browser or curl. What gives?
Restarting boot2docker fixed it for me. I think it had to do with switching wifi networks using different IP ranges.
$ boot2docker restart

Resources