rohit
rohit

Reputation: 1549

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

I am new to docker. When I am running 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.

Upvotes: 134

Views: 313593

Answers (30)

okaeiz
okaeiz

Reputation: 390

You need to add proxies to both these configuration files:

  1. /etc/systemd/system/docker.service.d/proxy.conf
  2. /etc/systemd/system/docker.service.d/docker.conf

For example, if you are using a SOCKS proxy, you need to add these lines to the [Service] section:

[Service]
Environment="HTTP_PROXY=socks5://[ip]:[port]"
Environment="HTTPS_PROXY=socks5://[ip]:[port]"

After adding these lines, you need to restart the daemon.

 sudo systemctl daemon-reload

And the Docker service:

sudo systemctl restart docker

You can check whether these lines have been successfully added by running:

sudo systemctl cat docker

You may need to scroll down to see the records. Then you can pull the image.

Upvotes: 0

Moosa Sharieff
Moosa Sharieff

Reputation: 157

I am using Colima to run docker engine on my mac. I was facing similar issue when pulling an image. I added nameserver 8.8.8.8 and nameserver 8.8.4.4. in /etc/resolv.conf file and restarted colima with command -> colima restart. After that, I was able to pull the image.

Upvotes: -1

Ed McManus
Ed McManus

Reputation: 7076

Disabling iCloud Private Relay fixed it in my case.

Upvotes: -1

vladkras
vladkras

Reputation: 17228

adding

"/var/run/docker.sock:/var/run/docker.sock"

to volumes and setting

privileged: true

for my runner in config.toml helped me

Upvotes: 0

Dominik Dorn
Dominik Dorn

Reputation: 1831

On my Mac, I accidentially blocked access for the registry in LittleSnitch . After I removed the block, everything worked again.

Upvotes: -1

Santosh Joshi
Santosh Joshi

Reputation: 3320

In my case, the issue was resolved by changing the DNS settings in Wi-Fi network.

By modifying the DNS server to ‍‍‍8.8.8.8 (Google Public DNS) from 192.168.1.1 it worked

DNS change in MAC

Upvotes: 1

Philip Afemikhe
Philip Afemikhe

Reputation: 19

I had this issue and tried so many solutions like restarting-docker, setting buildkit to false in docker-Engine setting tab (Docker Windows), etc, all to no avail. When I viewed my containers and images in Docker-window, the list were empty.

I re-installed docker and everything was fine.

Upvotes: -1

Jason Heithoff
Jason Heithoff

Reputation: 518

For me the issue was due to eval $(minikube docker-env) in my terminal .bash_profile/.profile

When this runs it sets

export DOCKER_HOST="tcp://192.168.64.4:2376"

To fix I ran

unset DOCKER_HOST

I also removed eval $(minikube docker-env) from my shell env.

Upvotes: 1

Hari
Hari

Reputation: 277

After trying most solutions mentioned on this page nothing worked for me. Weirdly mine worked after updating docker desktop from some 4.16.x to 4.17.1 That update restarted docker and might've fixed whatever the issue was. Hope it helps someone.

Upvotes: -1

Mehr Heer
Mehr Heer

Reputation: 31

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)

Upvotes: 2

Ali_Hr
Ali_Hr

Reputation: 4655

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.

Upvotes: 3

Shikhar Chaudhary
Shikhar Chaudhary

Reputation: 513

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.

Upvotes: 0

Chris Athanasiadis
Chris Athanasiadis

Reputation: 390

A restart of your internet connection might solve this.

Upvotes: 1

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!

Upvotes: -1

Dennis Van Bets
Dennis Van Bets

Reputation: 131

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

Upvotes: 6

ZenithS
ZenithS

Reputation: 997

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"
  ]

Upvotes: 4

dev_user
dev_user

Reputation: 417

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"

Upvotes: 0

Tushar Seth
Tushar Seth

Reputation: 613

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

Upvotes: 5

Jagadeeswar
Jagadeeswar

Reputation: 597

I was able to resolve by running the below command.

sudo systemctl restart docker

Upvotes: 42

Aishwarya Patil
Aishwarya Patil

Reputation: 567

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

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

Upvotes: 9

Abdullah Ahçı
Abdullah Ahçı

Reputation: 806

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

Upvotes: 3

Martin Karari
Martin Karari

Reputation: 188

Had same issue, I restarted docker and it worked

Upvotes: -1

Micael Mota
Micael Mota

Reputation: 580

I just restarted and it works fine again!

Upvotes: 4

Shajed
Shajed

Reputation: 667

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

Upvotes: 6

vikash vik
vikash vik

Reputation: 686

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

Upvotes: 10

ShailendraChoudhary
ShailendraChoudhary

Reputation: 153

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)

Upvotes: -1

Contropist
Contropist

Reputation: 431

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

Upvotes: 0

Nitin
Nitin

Reputation: 654

sudo vi /etc/resolv.conf

And change nameserver to 8.8.8.8

Upvotes: 16

Diya Li
Diya Li

Reputation: 1088

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

Upvotes: 3

cyberPrivacy
cyberPrivacy

Reputation: 917

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!

Upvotes: 36

Related Questions