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

Can't access WSL from inside docker #6175

Closed
mrsombre opened this issue Oct 30, 2020 · 3 comments
Closed

Can't access WSL from inside docker #6175

mrsombre opened this issue Oct 30, 2020 · 3 comments

Comments

@mrsombre
Copy link

Environment

Win32NT             10.0.19041.0 Microsoft Windows NT 10.0.19041.0
Ubuntu Release:        20.04
WSL 2

Steps to reproduce

  • I started a simple PHP server inside WSL Ubuntu
<?php
echo "test\n";
$ php -S 0.0.0.0:9003 index.php
[Fri Oct 30 21:08:04 2020] PHP 7.4.11 Development Server (http://0.0.0.0:9003) started
  • Find Ubuntu IP
$ echo $(ip route get 1.2.3.4 | awk '{print $7}' | tr -d "\n")
172.19.87.209
  • Try connect from Windows Host
PS C:\dev> curl 172.19.87.209:9003
test
  • try connect from Ubuntu itself
$ curl 172.19.87.209:9003
test
  • Start docker inside Ubuntu and try connect to Ubuntu
$ docker run --rm -it ubuntu bash
...
root@4ded615f2e7a:/# curl 172.19.87.209:9003
curl: (28) Failed to connect to 172.19.87.209 port 9003: Connection timed out

Expected behavior

Can connect to WSL Distro from inside docker

Actual behavior

No route to host

Ubuntu ip a

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 6e:4c:cb:e0:9a:cc brd ff:ff:ff:ff:ff:ff
3: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 2e:71:c5:93:65:ad brd ff:ff:ff:ff:ff:ff
4: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
5: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:15:5d:93:30:ff brd ff:ff:ff:ff:ff:ff
    inet 172.19.87.209/20 brd 172.19.95.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::215:5dff:fe93:30ff/64 scope link
       valid_lft forever preferred_lft forever
@mrsombre
Copy link
Author

Solved temporarily using port forwarding

netsh interface portproxy add v4tov4 listenport=9003 connectaddress=172.19.87.209 connectport=9003

@therealkenc
Copy link
Collaborator

/dupe #4150

@ghost
Copy link

ghost commented Oct 30, 2020

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!

This issue was closed.
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

2 participants