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.
[root@localhost asimwaheed]# cat /root/.docker/config.json
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:
You will get something like this:
Server: 22.214.171.124 Address: 126.96.36.199#53 Non-authoritative answer: Name: registry-1.docker.io Address: 188.8.131.52 Name: registry-1.docker.io Address: 184.108.40.206 Name: registry-1.docker.io Address: 220.127.116.11 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:
18.104.22.168 registry-1.docker.io 22.214.171.124 registry-1.docker.io 126.96.36.199 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 188.8.131.52 registry-1.docker.io 184.108.40.206 registry-1.docker.io 220.127.116.11 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
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: 18.104.22.168 Name: registry-1.docker.io Address: 22.214.171.124 Name: registry-1.docker.io Address: 126.96.36.199
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.
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 188.8.131.52 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! 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 184.108.40.206 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
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.