Running a Minecraft Bedrock Server
I’ve hosted plenty of Minecraft servers over the years on my desktop PC, but it took me quite a while to try to set a permanent solution up on the home server. It wasn’t terribly difficult, thankfully, but to spare you the trouble of figuring it out yourself, here are the steps I took. Note that this is the Bedrock edition of Minecraft. I haven’t tried a Java version, and when I do I’ll either update this post with the differences (if similar enough), or create a new post.
First things first, you’ll want docker and docker-compose. Once you’ve got them running, the rest of the setup is pretty easy. We’ll be using the itzg/minecraft-bedrock-server image.
You just need to do a few preliminary things before we get started. First, create a folder with a docker-compose file for your Minecraft server. You’ll want one of these for each server you run. It’s not hard to run multiple servers, but you can quickly get disorganized if you don’t name things well. I created two folders to begin with for the docker-compose files themselves: minecraftbds1 and minecraftbdc1, the first for a Minecraft Bedrock Survival server, and the second for a Minecraft Bedrock Creative server.
Next, you’ll want to create folders for the world saves. I store my worlds on a separate, much larger drive than my docker-compose files, which live on a much faster SSD, though I named the folders the same way to avoid any confusion.
Last, in your docker-compose folders, create the docker-compose.yml files. I used the template here as a starting point. Just make sure to set up your server name, game mode, difficulty, etc as you’d like them to be, as well as the volume, which should point to your world save folder for the server.
That’s it! In fact, if you only want to play at home on your local network, you’re completely done! Read on if you’d like to access the server from outside your home network.
Setting Up the Connection
I run an Nginx proxy for all the services I access from outside my home network. Plex, for example, routes through it. What it lets me do is have multiple web pages running simultaneously on the same machine, and it makes it really easy to access because I can host the services with addresses like “plex.mywebsite.com”. Nginx deserves it’s own post at some point, but for now, you won’t need it. In fact, I had to skip it completely to get this to work.
This thread was immensely helpful in helping me get started, but to spare you the headache I’ll describe what I had to do, step-by-step, to be able to access the server from anywhere. I use Dreamhost, so your steps may be slightly different.
For each server I run, I had to create a custom DNS entry of type SRV. Here are the settings:
Then, I had to port forward my router to the ports specified:
Each server has its own SRV record and port forwarding information. It’s a bit tedious, but it only takes a minute or two per server, and then you won’t have to change it.
You should be able to add the servers in Minecraft. If you just created the DNS records, it can take a few minutes for them to start working, so be patient with it. Minecraft may indicate that your servers are not online, but this is either a problem in the Docker image (e.g. it isn’t forwarding status properly), or a problem in Minecraft itself; you should be able to connect to the server even if it indicates that it’s offline.
Hope this helps anyone looking to host their own server!