46

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

1

7 Answers 7

38

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.

4
  • 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.
    – triple.vee
    Commented May 24, 2020 at 22:54
  • 1
    Introduction to Google Public DNS: developers.google.com/speed/public-dns/docs/intro Commented Apr 6, 2021 at 18:11
  • I had this issue when creating a cluster on kubernetes and know it's resolved with this answer. Commented Jun 12, 2022 at 17:26
  • 1
    I had this issue using Doppler. it works like a charm Commented Feb 10, 2023 at 18:51
10

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.

1

In my case, it was because of a typo mistake.

I wrote for example:

my-registryhob.mydomain.com

instead of:

my-registryhub.mydomain.com

Check for typo mistake..

1

I was running into this issue because we had a private module and I didn't configure private module environment variables. Adding these fixed my issue:

export GOPRIVATE="*.company.com"            
export GOPROXY=athens.company.com
export GONOSUMDB="*.company.com"

More details at: https://go.dev/ref/mod#private-modules

0

Seems like the domain name which you are using for your private repo is expired, that is why it is not resolving through global DNS 8.8.8.8 . Check with your Domain name provider.

0

Had the same error, and my problem was that I mistyped the registry url puting '.co' instead of '.com' at the end of host:

What I wrongly typed: *********.dkr.ecr.us-east-2.amazonaws.co

What shold be: *********.dkr.ecr.us-east-2.amazonaws.com

Causing to be a host that really doesn't exist. Always check it twice.

0

Facing the same issue dial tcp: lookup abc.com on 127.0.0.11:53: no such host.

Issue resolved when

Turn off the VPN

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.