dial tcp: lookup xxx.xxx.xxx.xxx: no such host

90,518

Solution 1

Editing the DNS nameserver in /etc/resolv.conf file helped me.

Change your existing nameserver to google nameserver i.e., x.x.x.x to 8.8.8.8

Comment your nameserver IP and add something like this :

#nameserver x.x.x.x
nameserver 8.8.8.8  

should work.

Solution 2

If you are behind a proxy, this could be your issue. In this case, you need to configure the Docker daemon (not the client) proxy settings. You can do that by:

  1. Create a systemd drop-in directory for the docker service:
    • sudo mkdir -p /etc/systemd/system/docker.service.d
  2. Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:
    • [Service] Environment="HTTP_PROXY=http://proxy.example.com:80/"
  3. Flush changes
    • sudo systemctl daemon-reload
  4. Restart docker daemon
    • sudo systemctl restart docker

Reference: Docker documentation.

Share:
90,518

Related videos on Youtube

pavan
Author by

pavan

Updated on March 27, 2022

Comments

  • pavan
    pavan about 2 years

    Trying to push an docker image to private docker repository. but getting error like: "dial tcp: lookup xxx.xxx.xxx.xxx: no such host". I have logged in correctly to the repository and build succeeded.

    The following command using to push the image to private repo: sud docker push x.x.x.x:446/dns/graphs

  • triple.vee
    triple.vee almost 4 years
    That did indeed work...thank you. Any idea why Google Cloud Shell is configured with a different nameserver than 8.8.8.8? The nameserver that is configured in resolve.conf by default is unreachable.
  • Enrique René
    Enrique René about 3 years
    Introduction to Google Public DNS: developers.google.com/speed/public-dns/docs/intro
  • Nasser Abdou
    Nasser Abdou almost 2 years
    I had this issue when creating a cluster on kubernetes and know it's resolved with this answer.