I am running docker and compose inside a Ubuntu 24.04 WSL2 installation without Docker Desktop. More specifically a Storyteller instance (Storyteller · GitLab)
Up until a couple of weeks ago everything worked fine, including, surprisingly, CUDA GPU passthrough, and I could access the Storyteller server from my network either via a browser or the specific android app. Now only localhost and the WSL internal ip works from the windows host. On the host not even 127.0.0.1 or the host ip works.
wslinfo --networking-mode returns nat but I also tried mirror. When in mirror I get errors that 8001 is already occupied and using another port just gives no connectivity again.
Just out of curiousity: have you check to which ip localhost resolves? Does it resolve to the ipv4 or ipv6 address?
Furthermore, all ports bound in a wsl distribution should be reachable from 127.0.0.1:<port inside wsl>. In case of a container the <port inside wsl> is the published host port. If you were able to reach the wsl port using the host ip, then you must have configured portforwarding (google should yield plenty of results about how it’s done). Docker Desktop on the other hand would have taken care of this out of the box.
In mirror mode the network packages of the host are mirrored into the wsl distribution, and the wsl distributions network packages are mirrored to the host. That’s why it appears as if they would share a network adapter. It looks like you already use the port either on the host or wsl distribution side.
Have you tried using the netstat command (you will need to figure out the exact parameters, as I don’t have a windows machine at the moment) on the Windows host, to identify which process binds the port, so you can stop it and try to publish the container port inside the wsl again?
inside ubuntu localhost resolves to 127.0.0.1, but you are right on the Windows terminal it points to a IPv6 address (vodafone.station is probably my router)
Can you try using the distribution’s host ip inside the wsl distribution? I am not sure if in nat-mode localhost inside the distribution is actually reachable from the host. In mirrored-mode it should work.
Looks like the address of your dns server (which in a home environment is usually the router). Though, the actual resolved entry is missing.
It is actually wsl -l -v, so use -l instead of list. I’m pretty sure @meyay knew it as well, but many other tools have “ls” or “list” subcommands so it is easy to accidentally write that.
It should have been --list instead of list. The shortcut -l is fine as well
Thank you for confirming that it’s a WSL2 distro.
I am not sure why you used ping to test access to the local ip, when you used curl before to test if the port is reachable.
You already showed curl commands that indicate the container is reachable from the host via locahost, I want to verify that it can be access from the distro’s own ip as well. I believe this is a necessity when you want it to be reachable from the Windows host.
the curl command was executed inside the WSL2 distribution
the WSL2 distribution has the ip 192.168.2.60
you installed the docker-ce packge and use vanila docker
when you deploy the container, you publish the container port to 8081 to the “host” (=WSL distro) port 8081.
wsl still uses networking mode nat
Unless the ip is not correct, or the bound host port is different or pinned to a specific ip, the curl command should have worked with the host-ip:port, the same way like it did with localhost:port.
Within the WSL distribution the windows firewall should not cause any inference.
192.168.2.60 is the host LAN IP and 172.20.80.1 would be the WSL gateway IP on the host. So curl was not used to send query to the WSL distro IP, but to the host. The prompt also indicates the curl command is not running on Windows at least, so I assume it is WSL, but trying to access a port on the host from the WSL distro.
As far as I know, “reset by peer” means somethnig got the request and terminated the connection. Since you tried to send a query to the Windows host.
So I’m not sure what happened, but it still looks like the port works but something intentionally rejects the request Have you checked the application logs? Or do you have anything between the app and the client? A proxy maybe?
Have you tried with as imple independent port test like:
python3 -m http.server 9898
And try to access it from the host using the host LAN IP.
This took a bit longer to get back to, sorry. You are right. 192.168.2.60 is the Windows host. I tried python3 -m http.server 9898 but it’s not visible either. As I said I thought some firewall in the docker Ubuntu distribution might be responsible, but I tried closing that and it didn’t help. Also, to remind you, everything worked fine for a long time until, suddenly the server wasn’t visible from the LAN anymore.