Skip to content

Special DNS name #4711

Closed
Closed

Description

@boan-jfm

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

Activity

  1. therealkenc commented on Nov 26, 2019

    @therealkenc

    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.

  2. xtremeperf commented on Dec 5, 2019

    @xtremeperf

    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)

  3. gwharton commented on May 3, 2020

    @gwharton
  4. microsoft-github-policy-service commented on Feb 1, 2024

    @microsoft-github-policy-service
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions