最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

windows - How to setup webapp inside docker in wsl to make it accessible in network? - Stack Overflow

programmeradmin1浏览0评论

I currently try to make a simple webapp accessible in my Network.

Server Hardfacts:

  • OS Windows 10
  • wsl version 2
  • Ubuntu-18.04 in WSL
  • docker version 28.0.1

I have set an inbound rule to let my port 4200 through the firewall. I also set up a netsh rule like this:

netsh interface portproxy add v4tov4 listenport=4200 listenaddress=0.0.0.0 connectport=4200 connectaddress=<WSL2_IP_Address>

I start my docker container like this:

docker run -d -p 4200:80 --restart unless-stopped --name test <docker-image>

When I run a dev container from wsl, I can open the webinterface through :4200. This only works when I changed the settings in vscode for "Local Port Host" to allInterfaces. So my system firewall does not block or anything. I already tried different advices from the web, but none of them worked for me.

Any ideas on how to access my app from a remote device?

UPDATE: When I activate docker desktop it works. Which settings are required, so I can use it without docker desktop?

发布评论

评论列表(0)

  1. 暂无评论