'Cannot reach docker container through WSL2

I run into an issue with a docker and WSL2 configuration that was running ok for weeks...

I'm running a docker Apache2 web server on Ubuntu WSL2 with port forwarding. I can see using nmap the 8080 Ubuntu port is open when docker image is running.

I can curl the web server from within the Ubuntu WSL2 using both 127.0.0.1:8080 and eth0 inet address (172.17.118.136:8080) and get the apache default page. I have an issue when trying to access the web server from my Windows host with the Ubuntu eth0 inet address : connection timed out.

From my Windows host the ping of Ubuntu eth0 is ok, and when I run an Apache2 web server directly from Ubuntu WSL2 (no docker), my Windows host is able to connect to it using eth0 inet address.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source