Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNS lookup failure for: host.docker.internal #3742

Closed
MinkiPan-zz opened this issue Jul 3, 2019 · 10 comments
Closed

DNS lookup failure for: host.docker.internal #3742

MinkiPan-zz opened this issue Jul 3, 2019 · 10 comments

Comments

@MinkiPan-zz
Copy link

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /.

Reason: DNS lookup failure for: host.docker.internal

I think this is similar to this one #2965

I urgently need help...

macOS Mojave
10.14.5

Docker Desktop 2.0.0.3
Engine: 18.09.2

@tjdavey
Copy link

tjdavey commented Jul 5, 2019

Does docker.for.mac.localhost resolve for you? My experience with this continuing issue is that docker.for.mac.localhost continues to work when host.docker.internal does not.

@tdtm
Copy link

tdtm commented Aug 14, 2019

Neither works for me.

Attempted with docker run --rm alpine nslookup host.docker.internal.

  • Docker Engine 19.03.1, build 74b1e89
  • Docker Machine 0.16.1
  • Docker Desktop 2.1.0.1
  • MacOS 10.14.6 (18G87)

@rossjp
Copy link

rossjp commented Oct 2, 2019

EDIT: In my case, this was due to configuring my shell with eval $(docker-machine env [machine name]). When not setting those shell variables, host.docker.internal does resolve for me. Still, I am going to keep using the qoomon/docker-host workaround to maintain portability.


Neither works for me either:

$ docker run --rm alpine nslookup host.docker.internal
nslookup: can't resolve '(null)': Name does not resolve
nslookup: can't resolve 'host.docker.internal': Name does not resolve

$ docker run --rm alpine nslookup docker.for.mac.localhost

nslookup: can't resolve '(null)': Name does not resolve
nslookup: can't resolve 'docker.for.mac.localhost': Name does not resolve
  • Docker version 19.03.2, build 6a30dfc
  • docker-machine version 0.16.2, build bd45ab13
  • Docker Desktop: Version 2.1.0.3 (38240), Channel stable
  • MacOS 10.14.5

Perhaps of interest: host.docker.internal was working for me before I performed a MacOS restart. Now it does not.

@simonlin527
Copy link

simonlin527 commented Oct 16, 2019

I have the same issue on

  • MacOS 10.14.6
  • Docker version 19.03.2 and 18.09.2, build 6247962.
  • Docker Desktop: Version 2.0.0.3 (31259)
  • Docker machine: 0.16.1

My current workaround is to hard code wherever I need to use the host ip. Horrible solution, but it works for now.

Simlarily, gateway.host.internal is also not working.
I also had a similar thing where host.docker.internal was working for a while, but after a restart of my Macbook it didn't work anymore.

@jmmen1
Copy link

jmmen1 commented Nov 21, 2019

I've had the same issue on both macos 10.14 and 10.15

Current setup is:

  • macos 10.15.1
  • Docker version 19.03.5, build 633a0ea
  • Docker Desktop: Version 2.1.0.5 (40693)
  • Docker Machine: 0.16.2

I've noticed that a clean install of Docker Desktop will resolve host.docker.internal. But, if I specify my company's DNS (or any DNS, really) via the docker run --dns option or by adding DNS entries in daemon.json, then host.docker.internal no longer resolves.

Also, it seems that docker.for.mac.localhost resolves to 127.0.0.1 inside the container, not to the Mac host IP.

@mattca
Copy link

mattca commented Dec 3, 2019

I experienced the same issue as @jmmen1 , same versions and the same thing where the problem would only occur when adding DNS entries.

I noticed that nameserver 192.168.65.1 was getting removed from the /etc/resolv.conf file in the started container when the custom DNS entries were present.

So if I added "192.168.65.1" as an extra DNS entry to the daemon.json with the other ones I wanted to define, then host.docker.internal would work as expected.

It might be that that IP is a default DNS entry, and when you define custom DNS entries via daemon.json, then the custom ones override that and it gets removed.

Can't confirm how reliable this is.

@jmmen1
Copy link

jmmen1 commented Dec 3, 2019

Indeed. I didn't want to assume that 192.168.65.1 will always be the host IP address. That's what the host name is for.

@mbreevoort
Copy link

Removing the dns section from my advanced daemon.json settings. It solved the problem and now the container now resolve host.docker.internal correct.

@docker-robott
Copy link
Collaborator

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30d of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle stale

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Jul 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants