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

Docker service running in wsl accessible on LAN but not host #11620

Closed
1 of 2 tasks
dagarwal82 opened this issue May 25, 2024 · 4 comments
Closed
1 of 2 tasks

Docker service running in wsl accessible on LAN but not host #11620

dagarwal82 opened this issue May 25, 2024 · 4 comments

Comments

@dagarwal82
Copy link

dagarwal82 commented May 25, 2024

Windows Version

Microsoft Windows [Version 10.0.22631.3593]

WSL Version

2.1.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.146.1-2

Distro Version

Ubuntu 22.04

Other Software

No response

Repro Steps

  1. Postgres docker running in wsl with 5432 port
  2. Wsl running in mirrored mode
  3. Both wsl and host (windows) has ip 192.168.0.131
  4. I can connect to 192.168.0.131:5432 from other machines in LAN (That is great !)
  5. But, can not connect to 192.168.0.131:5432 (or 127.0.0.1:5432 or localhost:5432) from host . None of the other wsl IP addresses are pingable from Host either (172...*).

This happens for all the services on wsl. How do I access these from host?
Tried disabling Hyper-V firewall but in vain.
Tried adding 5432 in both Inbound/Outbound rule in Hyper-V firewall but in vain.

None of the occupied ports in wsl shows up in netstat -an | find "" in windows host.

Expected Behavior

I should be able to access wsl services from host

Actual Behavior

Unable to connect to port from Windows Host

Diagnostic Logs

No response

Copy link

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please 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!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@johanhammar
Copy link

I'm also seeing this.

A simple test is to use Netcat

Runnc -l 4444 in WSL2 and try to access it from Windows. For me it just hangs

I've also tried to Allow inbound connections following the instructions on https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking with no success

@rcastagno
Copy link

I'm having a very similar issue.

Case 1

  • Docker compose up postgres
  • check connection: OK
  • launch wsl
  • check connection: KO
  • exit wsl
  • check connection after a few seconds: OK

Case 2

  • Docker compose up postgres
  • check connection: OK
  • from windows prompt launch bash script.sh (the bash script is in windows, but it's irrelevant
  • check connection: KO
  • stop the script
  • check connection after a few seconds: OK

Copy link
Contributor

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

Thank you!

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

3 participants