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

Windows hosts file has wrong IP address for host.docker.internal #10420

Open
1 of 2 tasks
jcoutch opened this issue Feb 18, 2021 · 10 comments
Open
1 of 2 tasks

Windows hosts file has wrong IP address for host.docker.internal #10420

jcoutch opened this issue Feb 18, 2021 · 10 comments

Comments

@jcoutch
Copy link

jcoutch commented Feb 18, 2021

This was originally opened as #8988, but was never acted upon and auto-closed. This is still a (highly annoying) issue.

  • I have tried with the latest version of my channel (Stable or Edge)
  • I have uploaded Diagnostics

Expected behavior

Hosts file contains the correct IP address for the primary network interface for both host.docker.internal and gateway.docker.internal.

Actual behavior

Docker for Windows pulls the IP address of a random network adapter (usually one that's not even connected), and uses that as the IP address.

Information

  • Windows Version: 10.0.19042
  • Docker Desktop Version: 3.1.0 (51484)
  • Are you running inside a virtualized Windows e.g. on a cloud server or on a mac VM: No

Steps to reproduce the behavior

Have multiple network cards connected to a machine, and randomly connect/disconnect them to get the wrong IP address populated.

Proposed solution

Allow the user to specify which network adapter to use for populating the host.docker.internal and gateway.docker.internal addresses. At the very minimum, give us the option to turn the auto-update of the IP address off. Or, even better, define a loopback network interface with a known IP address so you don't have to mess with the hosts file constantly!

@gregbown
Copy link

gregbown commented May 3, 2021

This is still problematic in version 3.3.1 (63152)
The GUI is not very helpful, as in there is nowhere to look up the internal IP or refresh it. So if it gets out of sync with your host file, you must restart Docker or your system in order to see it in your host file.

Please add a way to configure this or check it in the Docker GUI, or maybe post documentation on how to work around tis issue

@mg-christian-axelsson
Copy link

Still an issue after updating to 3.5.1

@docker-robott
Copy link
Collaborator

Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30 days 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

@jcoutch
Copy link
Author

jcoutch commented Sep 29, 2021

/remove-lifecycle stale

@jcoutch
Copy link
Author

jcoutch commented Sep 29, 2021

/lifecycle frozen

@tommitytom
Copy link

This is highly annoying. Are there any good workarounds? I've lost days of development time due to this issue

@bertenvdb
Copy link

Still a problem in 4.8.1. Just lost about 4 hours finding out why some services suddenly don't work anymore.

@andrii-myronenko
Copy link

Highly annoing problem. Are there any workarounds for this?

@ivalduan
Copy link

Same problem here. Closely related with #10856 #11814

@ivalduan
Copy link

As a temporal solution you can modify the hosts file properties to be read-only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants