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

Special DNS name #4711

Closed
boan-jfm opened this issue Nov 25, 2019 · 4 comments
Closed

Special DNS name #4711

boan-jfm opened this issue Nov 25, 2019 · 4 comments
Labels

Comments

@boan-jfm
Copy link

Could we have something similar in WSL2? Maybe host.wsl.internal, this may be used for the xdebug.remote_host within PHP development as well: https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html#configuring-xdebug-docker

The host has a changing IP address (or none if you have no network access). From 18.03 onwards our recommendation is to connect to the special DNS name host.docker.internal, which resolves to the internal IP address used by the host. This is for development purpose and will not work in a production environment outside of Docker Desktop for Windows.

https://docs.docker.com/docker-for-windows/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host

@therealkenc
Copy link
Collaborator

Brought up in #4199 and #4210, but neither are really on topic for the specific ask. This one can be the LZ for a local DNS name ask, independent of the localhost ask and the static ip ask.

@xtremeperf
Copy link

xtremeperf commented Dec 5, 2019

Install libnss-myhostname, a plugin for the Name Service Switch. It will always assign a hostname of _gateway that resolves to the current gateway/default route addresses, ordered by their metric. I use it for my X-server DISPLAY variable and it always resolves to the Windows host address, regardless of the current network configuration.

Also, since the Windows host and WSL have the same hostname, you can append a . (dot) to the hostname, which is how you request the hostname for the host closest to the root zone. The name server is running in Windows, so naturally its hostname is closer to the root zone. Windows also adds a $NAME variable to the shell environment when launching WSL, and it's value is the system hostname. So, the Windows host can be reached at ${NAME}. (notice the dot suffix, indicating we want the host closest to the root zone)

@gwharton
Copy link

gwharton commented May 3, 2020

#4210 (comment)

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

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

No branches or pull requests

6 participants
@therealkenc @bpulliam @boan-jfm @xtremeperf @gwharton and others