Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.65.1:53: no such host

DockerDocker MachineDocker Registry

Docker Problem Overview


I am new to dockers. When I am running the docker pull sonarqube I am getting the following error.

Error response from daemon: Get https://registry-1.docker.io/v2/: dial TCP: lookup registry-1.docker.io on 192.168.65.1:53: no such host

Can you please let me know why I am getting the error and how can I rectify this.

Docker Solutions


Solution 1 - Docker

I had similar issue on Ubuntu 16.04 and manage to solve it by adding more nameservers

You can try too.

  1. Open config file sudo nano /etc/resolv.conf and add the following under existing nameservers

    nameserver 8.8.8.8

    nameserver 8.8.4.4

  2. run following commands to restart daemon and docker service

    sudo systemctl daemon-reload

    sudo systemctl restart docker

Now try to pull image you want docker pull sonarqube

Solution 2 - Docker

In my case on a Mac, only a restart of the docker-machine did the work:

docker-machine restart

Uninstalling docker did not work! Just the above restart is enough!

Solution 3 - Docker

I was able to resolve by running the below command.

sudo systemctl restart docker

Solution 4 - Docker

sudo vi /etc/resolv.conf

And change nameserver to 8.8.8.8

Solution 5 - Docker

I had the same issue, for me I was behind my office proxy and docker was not picking up the proxy set for terminal. To fix this, i have to set the proxy in docker settings window, which can be accessed from

task bar -> docker -> settings enter image description here

Solution 6 - Docker

I was able to solve this issue, by logging into docker.

sudo docker login
Enter your login credentials 
sudo docker pull 'yourImageName'

Solution 7 - Docker

in windows, just restart the docker, it worked for me. Go to Docker Desktop dashboard, click on the icon with setting icon and click restart

Solution 8 - Docker

This could also be a DNS issue. Altering your nameservers will most likely resolve it, if is indeed related to your DNS.

You can verify the issue with: curl -vvv https://registry-1.docker.io/v2/ for a more detailed path.

If you are on ubuntu 18.04 or higher /etc/resolve.conf won't do the trick, they moved network management to NetPlan configs.

Add the google nameservers to your configuration (8.8.8.8 and 8.8.4.4)

find your network adapter name with ip a

network:
  version: 2
  renderer: NetworkManager
  ethernets:
      [network adapter name]:
              addresses: ...
              gateway4: ...
              nameservers:
                      addresses:
                              - 8.8.8.8
                              - 8.8.4.4
                      search: []

And run sudo netplan apply

Solution 9 - Docker

Disable experiment features and try again does the trick. Otherwise add the config below to daemon.json

"dns": [
    "8.8.8.8",
    "8.8.4.4"
  ]

Solution 10 - Docker

If your machine are located within the Great China area or using related Virtual Server, add Registry Mirrors to help your bypass the complex network router.

Or your can set a http_proxy for your docker configuration, referencing this link: https://docs.docker.com/config/daemon/systemd/#httphttps-proxy

Solution 11 - Docker

It happens when you are not logged in too, it happened to me. Problem gone after I logged in

Solution 12 - Docker

You need to add to your /etc/hosts in terminal write

$ sudo nano /etc/hosts

add below line and save it, try to run command and it will be working

34.228.211.243  registry-1.docker.io

Solution 13 - Docker

I just restarted and it works fine again!

Solution 14 - Docker

Things that might work:

  1. Check your proxy settings
  2. Restart docker
  3. Go to your docker settings and check if you're signed in to docker hub, if you aren't, sign in and try again (This worked for me)

Solution 15 - Docker

make sure that your server is not located in the following areas:

> Docker is a US company, we must comply with US export control regulations. In an effort to comply with these, we now block all IP addresses that are located in Cuba, Iran, North Korea, Republic of Crimea, Sudan, and Syria.

Solution 16 - Docker

A restart of your internet connection might solve this.

Solution 17 - Docker

In China, Add 114.114.114.114 to resolv.conf fixed it. sudo echo "nameserver 114.114.114.114" >> /etc/resolv.conf

Solution 18 - Docker

I was getting the same error. Tried a few things like restarting the server, checking configuration etc... Finally, it got resolved by adding proxies (since I was using it inside my organization network)

Solution 19 - Docker

Had same issue, I restarted docker and it worked

Solution 20 - Docker

I got the same error & I solved it by executing the below-mentioned commands, If you are working on the windows version, you can try these commands Steps to be followed : Open the command prompt & execute these commands,

set http_proxy="http://user:[email protected]:port"

set https_proxy="https://user:[email protected]:port"

Solution 21 - Docker

I had the same problem, for me it was ACR repository name that I have misspelled. Maybe check your variables. I used it within Github Actions in the secret sections.

Solution 22 - Docker

I had this same issue with a different solution. The issue was that the internet wasn't connected. That's another thing to check if none of these fix it for you!

Solution 23 - Docker

My issue was tha ti was behind a corporate proxy and hence i was unable to reach the registry-1.docker.io.

Solution:

I bypassed this URL registry-1.docker.io in the proxy server for following

  1. SSL bypass
  2. Authentication Bypass.

Then i configured the proxy settings in docker.service file in RHEL server as

Environment="HTTP_PROXY=http://proxy.example.com:80"
Environment="HTTPS_PROXY=http://proxy.example.com:443"
NO_PROXY=“tnd-harbor.india.airtel.itm,10.241.99.232,
registry-1.docker.io/v2/”

Make sure the HTTPS_PROXY protocol is http.

By doing this i was able to fetch images.

Solution 24 - Docker

Executing docker as root fixed this for me. Like this: sudo docker pull foo/bar

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionrohitView Question on Stackoverflow
Solution 1 - Dockerlev09View Answer on Stackoverflow
Solution 2 - DockercyberPrivacyView Answer on Stackoverflow
Solution 3 - DockerJagadeeswarView Answer on Stackoverflow
Solution 4 - DockerNitinView Answer on Stackoverflow
Solution 5 - Dockervikash vikView Answer on Stackoverflow
Solution 6 - DockerAishwarya PatilView Answer on Stackoverflow
Solution 7 - DockerTushar SethView Answer on Stackoverflow
Solution 8 - DockerDennis Van BetsView Answer on Stackoverflow
Solution 9 - DockerZenithSView Answer on Stackoverflow
Solution 10 - DockerDylanView Answer on Stackoverflow
Solution 11 - DockerAbdullah AhçıView Answer on Stackoverflow
Solution 12 - DockerShajedView Answer on Stackoverflow
Solution 13 - DockerMicael MotaView Answer on Stackoverflow
Solution 14 - DockerMehr HeerView Answer on Stackoverflow
Solution 15 - DockerAli_HrView Answer on Stackoverflow
Solution 16 - DockerChris AthanasiadisView Answer on Stackoverflow
Solution 17 - DockerzhiikerView Answer on Stackoverflow
Solution 18 - DockerShailendraChoudharyView Answer on Stackoverflow
Solution 19 - DockerMartin KarariView Answer on Stackoverflow
Solution 20 - Dockerdev_userView Answer on Stackoverflow
Solution 21 - DockerMarc OttenbacherView Answer on Stackoverflow
Solution 22 - Dockermy code made me suicidalView Answer on Stackoverflow
Solution 23 - DockerShikhar ChaudharyView Answer on Stackoverflow
Solution 24 - DockerChaserView Answer on Stackoverflow