Setting up a Minecraft Bedrock Server and making it accessible over the internet can be a rewarding experience. If you’re already using Traefik as your reverse proxy, you might be looking to extend its capabilities to manage your Bedrock server as well. This guide will walk you through the process of exposing your Minecraft Bedrock server behind Traefik, addressing common challenges and providing a clear path to success.
It’s understandable to encounter hurdles when venturing into new territories with tools like Traefik. Many users are comfortable using Traefik for web-based applications, leveraging its HTTP and HTTPS routing effectively for services like website dashboards or media servers. However, when it comes to game servers like Minecraft Bedrock, which primarily use UDP, the configuration can seem less straightforward.
Let’s break down the essentials to get your Bedrock server working seamlessly with Traefik.
Understanding the Bedrock Server and Traefik Configuration
Minecraft Bedrock Edition uses UDP port 19132 by default for game traffic. Unlike typical web applications that rely on TCP, Bedrock’s UDP nature requires a slightly different approach in your Traefik configuration.
Here’s a look at a basic Traefik configuration snippet that attempts to address Bedrock server exposure:
entryPoints:
http:
address: ":80"
https:
address: ":443"
tcpminecraft:
address: ":19132"
udpminecraft:
address: ":19132/udp"
This entryPoints
configuration in your traefik.yml
file defines listeners for different protocols. You have standard HTTP and HTTPS, along with attempts to define TCP and UDP entry points specifically for Minecraft. The intention is to direct UDP traffic on port 19132 to your Bedrock server.
However, simply defining entry points is not enough. You also need to ensure your Docker Compose setup correctly maps these ports and that you are using the right rules to route traffic.
Docker Compose Configuration for Traefik and Minecraft Bedrock
When deploying Traefik and your Minecraft Bedrock server using Docker Compose, port mappings are crucial. Here’s a typical excerpt from a Traefik Docker Compose service definition:
ports:
- "80:80"
- "443:443"
- "19132:19132/udp"
This configuration maps host ports 80 and 443 to the corresponding ports in the Traefik container for HTTP and HTTPS. Critically, it also includes 19132:19132/udp
, which is essential for forwarding UDP traffic for the Bedrock server. Note that exposing TCP port 19132 might not be necessary for the server to function correctly in this context, and is often commented out as shown in the original example.
Now, let’s consider the Docker Compose for your Minecraft Bedrock server itself. A typical setup might look like this:
version: '3'
services:
minecraft:
image: toasterlint/minecraft_bedrock
ports:
- "19132:19132/udp" # Ensure UDP port is mapped
environment:
EULA: "TRUE" # Accept Minecraft EULA
SERVER_NAME: "My Bedrock Server"
SERVER_PORT: "19132" # Bedrock server port
networks:
- proxy # Assuming 'proxy' is your Traefik network
In this Minecraft service definition, the key is to map the container’s UDP port 19132 to the host’s UDP port 19132. This ensures that UDP traffic reaching your server on port 19132 is correctly directed to the Minecraft Bedrock server container. Also, ensure both Traefik and Minecraft containers are on the same Docker network (here named ‘proxy’) to allow Traefik to route traffic to the Minecraft service.
Addressing Routing and Domain Concerns
A common point of confusion is how domain names and routing rules apply to UDP services like Minecraft Bedrock. Unlike HTTP services where Traefik uses host-based routing (e.g., Host(
example.duckdns.org`)`), UDP services don’t inherently operate with hostnames in the same way.
The line traefik.http.routers.minecraft.rule=Host(
example.duckdns.org`)` from the original attempt is indeed more relevant for HTTP routing. For UDP, especially for a Minecraft Bedrock server, you are primarily concerned with port-based forwarding.
For Bedrock, players typically connect using the server’s IP address and port directly, not a domain name in the traditional web sense. The “friends list” visibility within your LAN confirms the server is running and discoverable on your local network. The challenge is extending this accessibility over the internet via Traefik.
The key is to ensure that Traefik is correctly listening on the UDP entry point (udpminecraft
) and forwarding traffic arriving on that entry point to your Minecraft Bedrock service. You might not need an HTTP router rule in the same way as for web applications.
If you intend to use a domain or subdomain to point to your Minecraft server’s IP for easier player connection (though players still input IP or DNS and port in the game client), you would typically manage the DNS record to point your domain (e.g., mc.example.com
) to your public IP address where Traefik is running. Traefik, configured with the UDP entrypoint, will then forward the UDP traffic on port 19132 to your Bedrock server.
Troubleshooting and Verification
If your server is showing up on your LAN but you can’t connect via an external IP, consider these troubleshooting steps:
-
Firewall: Ensure that your firewall (both on your server and any network firewalls) allows UDP traffic on port 19132.
-
Public IP: Verify that you are using your public IP address when trying to connect from outside your LAN.
-
Traefik Logs: Examine Traefik logs for any errors related to UDP entry points or routing. Logs can provide clues about misconfigurations.
-
Portainer or Docker Inspect: Use Portainer or
docker inspect
commands to verify that your Traefik and Minecraft containers are indeed on the same network and that ports are mapped as expected. -
Simple UDP Listener (for testing): For debugging, you could temporarily run a simple UDP listener container to confirm that Traefik is indeed forwarding UDP traffic to the backend network.
Conclusion
Exposing a Minecraft Bedrock server with Traefik primarily involves correctly configuring UDP entry points in Traefik and ensuring proper port mapping in your Docker Compose setup for both Traefik and the Bedrock server. While domain-based routing isn’t directly applicable to UDP game servers in the same way as HTTP websites, Traefik can effectively forward UDP traffic based on entry points, allowing you to manage access to your Bedrock server. By focusing on UDP configuration, port mappings, and network connectivity, you can successfully make your Minecraft Bedrock server accessible through Traefik.