Hi everyone! I'm new to Docker and just set up a modded Minecraft server using itzg. I can access the server fine from my local network, but I'm really struggling with how to port forward so my friends can join in. I'm using Docker on WSL2 on my Windows 11 PC. The IP address I see for Docker (172.x.x.x) doesn't seem to work with my router. It only recognizes my PC's local IP. Can someone guide me on how to properly port forward this Docker server so my friends can connect?
5 Answers
When port forwarding on your router, you essentially map public ports to your private address. Docker assigns containers their own private IP addresses, but you can publish ports from these containers on your PC's IP. So, you would forward your Minecraft port to your PC's IP address on your router, and then publish the port in Docker directly to make it work. It's like setting up two levels of port forwarding!
Using Docker on WSL2 could complicate things. If you have Windows Pro, consider setting up a Hyper-V VM with a bridged virtual switch instead. This will simplify networking and help avoid a lot of the NAT issues you're facing. Docker Desktop and WSL2 create some complex setups that aren't the best for production use.
While using a VPN or complex setups is great, simplify your approach if you're new to this. Rather than using common ports that can attract hackers, opt for less commonly used ports for your Minecraft server.
Do you have a public IP? If not, your friends won't be able to connect to your server. You need a public IP for them to join.
Be careful when opening ports on your router! This can expose your network to risks. I suggest setting up a simple VPN server in another Docker container, like using WireGuard. This allows your friends to connect securely without exposing your entire network. Alternatively, you could get a domain and use Cloudflare for DNS, then set up Nginx Proxy Manager for safer access.
Related Questions
Sudoku Solver
Tambola Number Generator
Tambola Ticket Generator
UK Bingo Card Generator
US Bingo Card Generator
Bingo Number Generator