WSL
WSL copied to clipboard
Cannot access host networking port when using mirrored mode in a specific case
Windows Version
10.0.22635.5240
WSL Version
2.5.7.0
Are you using WSL 1 or WSL 2?
- [x] WSL 2
- [ ] WSL 1
Kernel Version
6.6.87.1-1
Distro Version
Ubuntu 24.04
Other Software
I'm running a container in Podman Desktop.
podman run -d --device nvidia.com/gpu=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
I verified on Windows that I can access the port correctly:
PS C:\Users\crloewen> curl http://localhost:11434/
Ollama is running
Repro Steps
- Run WSL on mirrored mode
- Install Podman Desktop
- Run this command in Podman to create a container
podman run -d --device nvidia.com/gpu=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama - Try to access the port
curl http://localhost:11434/and it hangs
Expected Behavior
The port should be accessible just like in PowerShell or in a browser which works in Windows.
Actual Behavior
The curl call hangs but only in WSL.
Diagnostic Logs
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 script will output the path of the log file once done.
If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here
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'.
Logs are too big
/emailed-logs
Diagnostic information
Found '/emailed-logs', adding tag 'emailed-logs'
Please check if either of these fixes your issue:
https://learn.microsoft.com/en-us/windows/wsl/troubleshooting
Docker container issues when its Network Manager is running There is a known issue with Docker containers which have the Network Manager service running. Symptoms include failures when trying to make loopback connections to the host. It is recommended to stop the Network Manager service for WSL networking to be configured properly.
sudo systemctl disable network-manager.service
https://learn.microsoft.com/en-us/windows/wsl/wsl-config
Add this and set it to true:
hostAddressLoopback
Only applicable when wsl2.networkingMode is set to mirrored. When set to True, will allow the Container to connect to the Host, or the Host to connect to the Container, by an IP address that's assigned to the Host. The 127.0.0.1 loopback address can always be used,this option allows for all additionally assigned local IP addresses to be used as well. Only IPv4 addresses assigned to the host are supported.
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!
Reopening since this still exists