Has anyone used WSL2 and connected to the host machine using its actual IP instead of through the WSL2 Network Adapter IP?
My situation is this: My ip is 192.168.1.2
I start a webserver on my actual machine, it binds to 127.0.0.1, and 192.168.1.2 I want do connect to the webserver from within a docker container under WSL2. If I ping/telnet/curl to 192.168.1.2 the call simply fails from a timeout, this happens both from my docker container as well as straight from within ubuntu under WSL2
I have verified that I can ping my router at 192.168.1.1 from within my docker container. I cannot access 192.168.1.2 from within my WSL2 shell outside of docker. I cannot use 127.0.0.1 as a replacement, as the end goal is to run a setup of docker inside WSL2, that calls the webserver on my machine (i.e. I want to start up 4 services and a database through docker, and then actively develop and debug a 5 service on my actual machine).
I've tried disabling the firewall completely to no avail.
Does anyone have an idea of what it could be? Or if I'm even supposed to be able to access 192.168.1.2 from within WSL2.
$(hostname).local
, also check #65626262 for enabling traffic from WSL2. And to access host from docker -host.docker.internal
( #31325481 ) – Pentarchyserver { listen 80; server_name localhost; ...}
) . By default requests from WSL2 were blocked but once blocking nginx rules for Public profile in Win Defender Firewall were disabled, everything (i.e.curl $(hostname).local
from WSL2) )seems to work just fine. – Pentarchy