-
Notifications
You must be signed in to change notification settings - Fork 822
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
Cannot access port on Windows from Docker container via host-gateway #12023
Comments
View similar issuesPlease view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it! Closed similar issues:
Diagnostic information
|
Looks like you're connecting to the |
Yeah, that’s what is allowing the second test to work. I was under the expectation the first option would work too, unless im understanding wrong? |
So I'm not entirely sure why, but after a fresh boot today host.docker.internal is now resolving to the IP of my host, and so its working now. |
Windows Version
Microsoft Windows [Version 10.0.22631.4037]
WSL Version
2.3.17.0
Are you using WSL 1 or WSL 2?
Kernel Version
Linux version 5.15.153.1-microsoft-standard-WSL2
Distro Version
Ubuntu 20.04
Other Software
Docker version 27.2.0, build 3ab4256
Repro Steps
My setup is as follows.
WSL Config:
I expect my docker containers to be able to connect to the debugger running on Windows, but they are not able to connect.
The docker container is configured with an extra_host to post host.docker.internal to the host gateway:
- "host.docker.internal:host-gateway"
From the docker container, I get these results:
If I try the IP of my Windows host directly, that does seem to work:
However, I would expect the first attempt to also work, so that I can avoid hardcoding my windows IP in my docker setup.
Expected Behavior
Connecting to a Windows host port over the docker host IP or Ubuntu host IP should work
Actual Behavior
Connection is not possible
Diagnostic Logs
The networking logs were recorded while running both the unsuccessful and successful attempts above
WslNetworkingLogs-2024-09-11_18-52-21.zip
The text was updated successfully, but these errors were encountered: