WSL2 (docker) ports are not openend on host

Viewed 5171

When I run an image through docker in WSL2, the ports are not published on the host machine. Why is this? What can I do to make this work?

Screenshot

1 Answers

So while I still don't know why this happens (sometimes) it appears a restart fixes it (temporarily?):

(on windows cmd)

> wsl --shutdown

Re-running the same commands as above yields mapped ports also visible ob the windows host machine:

C:\WINDOWS\system32>netstat -ano | findstr 55580
  TCP    127.0.0.1:55580        0.0.0.0:0              ABHÖREN         12392
  TCP    [::1]:55580            [::]:0                 ABHÖREN         12392

The 12392 PID is wslhost.exe

Related