You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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)
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.
Activity
therealkenc commentedon Nov 26, 2019
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 commentedon Dec 5, 2019
Install
libnss-myhostname, a plugin for the Name Service Switch. It will always assign a hostname of_gatewaythat 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 commentedon May 3, 2020
#4210 (comment)
microsoft-github-policy-service commentedon Feb 1, 2024
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!