Docker

[WSL2] 특정 포트 열기

_HelloWorld_ 2025. 2. 17. 10:40

규칙 추가

New-NetFirewallRule -DisplayName "Allow 8080" -Direction Inbound -Protocol TCP -LocalPort 8080 -Action Allow
New-NetFirewallRule -DisplayName "Allow 3000" -Direction Inbound -Protocol TCP -LocalPort 3000 -Action Allow

 

WSL 내부 IP를 활용하여 바인딩

netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=8080 connectaddress=[WSL IP] connectport=8080

netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=3000 connectaddress=[WSL IP] connectport=3000
PS C:\Users\MOA> netsh interface portproxy show all

ipv4 수신 대기:             ipv4에 연결:

주소            포트        주소            포트
--------------- ----------  --------------- ----------
0.0.0.0         8080        WSLIP           8080
0.0.0.0         3000        WSLIP           3000

 

'Docker' 카테고리의 다른 글

[Go][Gin]분리 된 앱을 배포할 때  (0) 2025.02.13
rocky9 - Docker 설치하기  (0) 2024.12.30
PostgreSQL과 pgAdmin을 위한 Docker Compose 설정  (1) 2024.12.18