-
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
WSL2 can't reach a docker container's ports mapped to 127.0.0.1 #9515
Comments
It happens to me, again after last update 22623.1180 |
Didn't work for me unfortunately, but thanks for the comment |
it worked just for only one page load |
Highly likely related to recent similar issues: WSL/issues/9516 and WSL/issues/9508 |
For what it's worth, a full clean windows (re)install seems to have helped |
That is overkill and unnecessary. This seems to be a bug, so just revert to an older WSL version for the time being like here: |
I didn't bother doing that because I hadn't upgraded wsl once that started happening, but I'm glad it worked for you |
Non deterministic repro instructions here: #9516 (comment) . If someone is experiencing failure to forward after a period other than exactly 1 minute then please say. Because in that case there may be a second issue. Thanks again for your patience. /dupe #9508 |
Hi! We've identified this issue as a duplicate of another one that already exists in this repository. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report! |
Version
Windows version: 10.0.22621.1192
WSL Version
Kernel Version
5.15.83.1
Distro Version
Ubuntu 20.04
Other Software
DOCKER:
Client:
Cloud integration: v1.0.29
Version: 20.10.22
API version: 1.41
Go version: go1.18.9
Git commit: 3a2c30b
Built: Thu Dec 15 22:36:18 2022
OS/Arch: windows/amd64
Context: default
Experimental: true
Server: Docker Desktop 4.16.2 (95914)
Engine:
Version: 20.10.22
API version: 1.41 (minimum version 1.12)
Go version: go1.18.9
Git commit: 42c8b31
Built: Thu Dec 15 22:26:14 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.14
GitCommit: 9ba4b250366a5ddde94bb7c9d1def331423aa323
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0
VSCode: 1.74.3 w/ Remote WSL extension
Repro Steps
Not sure if this is reproducible, since the issue just appeared out of nowhere - things worked fine yesterday
Expected Behavior
WSL2 should be able to connect to any containers with port mappings that explicitly use
127.0.0.1
as the hostname instead of the very permissive0.0.0.0
.Actual Behavior
For some reason docker containers started with port mappings that map to 127.0.0.1 specifically, e.g.
-p 127.0.0.1:8020:8020
don't work inside the WSL2 (Ubuntu) environment. I've got a basic web server container started this way and any attempts tocurl http://127.0.0.1:8020
from inside the WSL2 environment (not even from Windows!) fail with a "Connection refused".It's as if the Docker container is blocking the connection because it thinks the connection that is coming from 127.0.0.1 actually isn't coming from 127.0.0.1, because if I just use a port mapping like
-p 8020:8020
which maps the ports to0.0.0.0
instead of127.0.0.1
then it works and the connection to the web server isn't refused anymore.I tried debugging this by making my web server respond by emitting the incoming request IP into the body and saw something strange. I ran the web server with
-p 8020:8020
to make sure I can connect to it, did acurl http://127.0.0.1:8020
from inside WSL2 (not Windows!) and the remote address was outputted to be: 172.17.0.1.Could that be the issue? The remote address should be 127.0.0.1, but it comes in as 172.17.0.1 so Docker doesn't allow connections from WSL2 if the ports are explicitly only mapped to 127.0.0.1
Diagnostic Logs
WslLogs-2023-01-20_16-40-07.zip
The text was updated successfully, but these errors were encountered: