[Ubuntu WSL2] Access WSL Docker containers from outside Docker Host reddit / selfhosted ---------------------------------------------------------------------- scionae · 2023-11-04 16:28 Hi everyone! I set up a container on my Windows machine since I needed the beefed up hardware and while it works, I'm stuck now. I can access the container by connecting to WSL's eth0 interface, so I grab that IP, slap the container port and I can access it directly from my Windows machine. Unfortunately, the same doesn't work when I try to access the same IP:port from my phone / other pc. I also tried using the Docker Host's IP but that didn't work either. I tried host network but no IP is assigned to the container so it ain't my use case. ​ So, what do I do? I need this container to be accessible from outside WSL (working on my Docker Host), but also outside my Docker Host (Windows PC). ---------------------------------------------------------------------- thekrautboy · 2023-11-04 17:25 > I tried host network but no IP is assigned to the container so it ain't my use case. The container wouldnt get its own IP, it uses the IP of the host, thus host networking. /r/Docker exists btw. ---------------------------------------------------------------------- scionae · 2023-11-04 17:29 Well didn't work anyways, connected to the host ip and couldn't ping the container, probably because I have to expose the port in the router I guess ---------------------------------------------------------------------- iamdadmin · 2023-11-04 18:48 Install docker desktop on Windows and set it to run Linux containers instead of having WSL in the middle, maybe? ---------------------------------------------------------------------- theonewhoshouldnot · 2023-11-04 21:27 I had the same problem and solved it using the new wsl update. Basically, you set the wsl networking mode to bridged, and it will use the same ip of your Windows host. I also had to install docker on wsl, not on Windows. ---------------------------------------------------------------------- scionae · 2023-11-04 21:36 Works, but unfortunately the Windows firewall is fucking me up. I can't access my containers outside of my host except of when I open the 8096 port in the firewall for all applications, what rule did you add in your firewall to make it work? ---------------------------------------------------------------------- theonewhoshouldnot · 2023-11-04 21:41 I use kaspersky so I didn't have to deal with firewall