Getting Error when pulling image from docker hub

Hi Team,
I hope you are doing well. I have been facing an error for the last 2 days. When I run docker run hello-world if the image is available locally then it fetches but when it pulls from the docker hub repository it shows the following error:
[root@localhost asimwaheed]# docker run hello-world
Unable to find image ‘hello-world:latest’ locally
docker: Error response from daemon: Get “https://registry-1.docker.io/v2/library/hello-world/manifests/sha256:88ec0acaa3ec199d3b7eaf73588f4518c25f9d34f58ce9a0df68429c5af48e8d”: dial tcp [2600:1f18:2148:bc00:e947:5a7f:a49f:9126]:443: connect: network is unreachable.
See ‘docker run --help’.
I tried many solutions and sometimes it works but when I shut down my PC and log in again it again shows this and now it is not going again and again showing the same error. I used docker login, and docker logout many times but still faced the same error. I kindly request you to review my query and provide me with a solution. I am using Centos 7 virtual machine in Oracle virtual box. Here I provide some more command output:
[root@localhost asimwaheed]# docker login
Authenticating with existing credentials…
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning.
Login Succeeded
[root@localhost asimwaheed]# cat /root/.docker/config.json
{
“auths”: {
https://index.docker.io/v1/”: {
“auth”: “REDACTED”
}
}
}

1 Like

This could be connectivity issue. Also check firewall and proxy settings

Also this article Troubleshooting Network unreachable might help as well.

I tried all these solution but thank you very much for your response.

This is either a problem with Docker Hub when accessed by ipv6, or a problem on the host level.
Any availability problem with Docker Hub should be visible on https://www.dockerstatus.com

can you please guide me in the form of some steps? I would appreciate it and thank you so much for your kind response.

I am not sure how you think I can help. Either it’s a Docker Hub problem (then it should be visible on the status page, and it would affect high likely more users) or a problem with your host or lan networking.

If you are experience the issue on a company computer, you should ask your it-support for help. If it’s a private computer, you will need to fix your network issues yourself.

A working network setup is a precondition to run docker.

okay thanks for your info

actually, docker works fine on centos 6 and even other distros but not on centos 7.

Run this command:

nslookup registry-1.docker.io

You will get something like this:

Server:		8.8.8.8
Address:	8.8.8.8#53

Non-authoritative answer:
Name:	registry-1.docker.io
Address: 44.205.64.79
Name:	registry-1.docker.io
Address: 34.205.13.154
Name:	registry-1.docker.io
Address: 3.216.34.172
Name:	registry-1.docker.io
Address: 2600:1f18:2148:bc00:e947:5a7f:a49f:9126
Name:	registry-1.docker.io
Address: 2600:1f18:2148:bc02:4bf0:3a98:55ae:e3d5
Name:	registry-1.docker.io
Address: 2600:1f18:2148:bc01:c4:4967:28eb:1824

Get the ipv4 addrasses and add them to your /etc/hosts file like this:

44.205.64.79   registry-1.docker.io
34.205.13.154  registry-1.docker.io
3.216.34.172   registry-1.docker.io

This way my file in my virtual machine looks like this:

(yours will be different)

127.0.1.1 docker-vm docker-vm
127.0.0.1 localhost
# 127.0.1.2 registry-1.docker.io
44.205.64.79   registry-1.docker.io
34.205.13.154  registry-1.docker.io
3.216.34.172   registry-1.docker.io

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Then if your /etc/resolv.conf is a symbolic link to /run/systemd/resolve/stub-resolv.conf, the following command would read the hosts file and return only ipv4 addresses. Otherwise you will not see difference here

nslookup registry-1.docker.io

In case you had the “stub resolver” enabled, you will see something like this:

Server:		127.0.0.53
Address:	127.0.0.53#53

Name:	registry-1.docker.io
Address: 44.205.64.79
Name:	registry-1.docker.io
Address: 34.205.13.154
Name:	registry-1.docker.io
Address: 3.216.34.172

Then try docker run hello-world.
If nslookup ignores the hosts file and you see the ipv6 domains, you can still try the docker run command. If it solves your problem, the IPv6 settings are wrong on your machine, but that’s about all I can help you know. If it doesn’t help, you can try to find out what you run on CentOS 7 that you don’t run on CentOS 6. It could be firewall or any security modul, although based on the error message I would agree with @meyay about the IPv6 settings.

also note that I tried these in an Ubuntu 22.04 virtual machine so you could have different result on CentOS

NOTE: Thanks to @meyay I realized nslookup “read” my hosts file only because I had the stub resolver enabled on Ubuntu. I edited my post above to include that, but docker should still use the hosts file. I did ony my machine even with the disabled stub resolver.

1 Like

Hi Mr. Rimelek. I thank you for your helpful response. I just opened my/etc/resolv.conf file and changed 192.168.10.1 with 8.8.8.8 and then tried the docker run the command it worked. I thank for you, your time and your suggestion. You solved my whole week’s worry in a single response. Merci beaucoup special thanks in French.

Thank you for reporting back! I’m glad it helped! :slight_smile: Manually changing the DNS server could help, but I hope your resolv.conf is not a symbolic link, otherwise it could be reset when you reboot the machine.

Absolutely. Now I am working on how to permanently set 8.8.8.8 even when the machine is booted it will not affect it. Thanks for your response. I would appreciate the efforts that you have made for me.

WHat do the following commands give you?

readlink -f /etc/resolv.conf
realpath /etc/resolv.conf

If that is a link, you could simply remove the link and create a static file with the content you like. If the file changed a different way on CentOS, you need to find out what changes it. I usually set nameservers using netplan on Ubuntu servers (/etc/netplan/). So whatever network manager tool used on CentOS that should manage the DNS server.

Thanks for your response. I got it and now even though my virtual machine is booted only ip is changed rest of the settings remain the same I made. Merci beaucoup.

Hello All, I am having the same problem here. I cannot pull any image from the hub. Nor can I login to the hub. The strange thing is when I connect my Raspberry Pi running Docker to a different router with amobile connection everything is working. So the image pull is not working on the network of my fiber connection but it is working on a router with a mobile connection.

It seems like the provider of my fiber connection does not allow DNS for the registry-1.docker.io.
I also thried changing the DNS of the pi but that did not help.

Anyone knows what I can check on my router to allow this image pull?
I also disabled the firewall.

Thanks for the help. I was running docker on a raspberry Pi Zero 2 with the 32bit Lite os and getting errors:
docker: Error response from daemon: Get "https://registry-1.docker.io

your suggestion of the additions to /etc/hosts was the fix I needed. I used:
sudo apt-get install dnsutils
nslookup registry-1.docker.io
sudo nano /etc/hosts

Hi,any luck facing the same issue