Accessing WSL2 exposed ports via ZeroTier [Answered]

To make the story short, I have WSL2, in which I have Docker, in which I have two docker images, one for phpMyAdmin and another for the web app being developed. I want to be able to access those services in the browser on other machines connected to the same ZeroTier One network.

Here are the relevant results from running docker ps:

PORTS                                                                               NAMES                          
50505/tcp                                                                           smt_skell_jasper_1             
4369/tcp, 5671-5672/tcp, 25672/tcp, 0.0.0.0:49154->15672/tcp, :::49154->15672/tcp   smt_skell_rabbitmq_1           
0.0.0.0:49153->80/tcp, 127.0.0.1:8032->80/tcp, :::49153->80/tcp                     smt_skell_phpmyadmin_1  <-- This one       
33060/tcp, 127.0.0.1:8031->3306/tcp                                                 smt_skell_mysql_1              
1025/tcp, 127.0.0.1:8004->8025/tcp                                                  smt_skell_mailhog_1            
6379/tcp                                                                            smt_skell_redis_1              
0.0.0.0:49155->80/tcp, 127.0.0.1:8030->80/tcp, :::49155->80/tcp                     smt_skell_web_1 <-- This One

And here I ran netstat -ab in the host:

[wslhost.exe]
  TCP    127.0.0.1:8030         EvidentlyPC:0          LISTENING
[wslhost.exe] <-- This one I don't care about
  TCP    127.0.0.1:8031         EvidentlyPC:0          LISTENING
[wslhost.exe]
  TCP    127.0.0.1:8032         EvidentlyPC:0          LISTENING

I have enabled those ports in the firewall (even tried disabling the firewall altogether), restarted zero tier on both machines but to no avail. I have another service (VS Code’s code-server) exposed on port 12345, with firewall rule added which I can access. It displays slightly differently with netstat though:

TCP    127.0.0.1:12345        EvidentlyPC:52402      ESTABLISHED
TCP    127.0.0.1:12345        EvidentlyPC:52405      ESTABLISHED

While the docker images have foreign port set to 0, this has 52402 and 52405. Not sure if it makes a difference, I am quite out of my depth here, so I’d appreciate any help :).

I’ve managed to solve the issue by forwarding ports from the host, like here: Running a public server from WSL 2

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.