For some time I've run a Minecraft Bedrock server for my kids on an old 2013 Macbook Pro, which was running Ubuntu 18.04. Apart from occasionally updating the Minecraft server software I've barely had to touch it, but that process was still a little tedious, and then recently I hit the point where I couldn't easily update Ubuntu because that release was no longer supported. I attempted to do an upgrade but downloading the packages took so long (no idea why, it wasn't my connection) that I got bored and decided to start over. In addition I wanted to explore the idea of being able to run multiple servers on the one machine.
In the end there were a few separate steps involved in achieving my goals, but the process wasn't immediately obvious - at least getting the servers up was ok, but making them visible to the XBox client less so, as it doesn't let you add a server by entering the IP address.
Because the Linux binary provided by Microsoft is built for Ubunutu, I decided to stick with that distribution and downloaded the brand new 24.10. It took a little while to sort out the WiFi drivers (proprietary Broadcom ones required) but other than that it was smooth sailing. In my head Ubuntu is still a "new" distro, it boggles my mind to think that it's now 20 years old.
Once that was done I decided to have a look at using Docker to run the server. Although I've always vaguely known about what Docker does and is, I've never used it beacuse I've not had reason to, but I had a hunch that it would not only make running multiple servers easier, it would also mean I could run multiple without having them run on different ports.
Note (18/10/24) - The steps below are me writing them out retroactively. There could be something missing but hopefully it's enough to guide you through a process that took me a fair bit of trail, error and research. I will run these from scratch in a VM in the near future and ensure they're as accurate as possible.
Rather than go into detail here, I suggest visiting the official Docker website's install instructions.
Karl Rees, along with a couple of others, created docker_bedrockserver, which is a docker container setup to run the bedrock_server
binary that you'd usually download directly from Microsoft. In fact, his repository includes scripts to automatically update the servers on restarting the containers. That said, when I tried to get it going there were a few things that were a little out of date. I'm going to open a pull request shortly to get those changes into Karl's repo (hopefully), but for now you can clone from the fork I created - https://github.com/mattlacey/docker_bedrockserver. It's probably worth reading the README in it's entirety, but following is the part relevant to setting up multiple servers quickly.
README.md
starts here
To run multiple servers using multiple Bedrock worlds, each running at a separate IP address on your LAN, the setup script can try to setup your environment for you. Be sure to install docker-compose.
Download the source code from git.
git clone https://github.com/mattlacey/docker_bedrockserver
Run the setup_multi.sh script.
cd docker_bedrockserver
./setup_multi.sh
This copies the example .env
file, docker-compose.yml
file, and mcdata
folder to their expected locations, and populates the environment variables with some naive assumptions about your network and mcdata storage location.
If you want more than just the two example servers, edit the docker-compose.yml
file to include a separate section for each server. Be sure to change the name for each server--change both the container_name property and the WORLD environment variable. Be sure to use a different IP address for each server as well.
Run docker-compose
docker-compose up -d
README.md ends here
At this point it pays to read some of the Docker documentation, but in short you now have two containers running, each hosting a server. You can check they're running using docker ps
, and stop them both with docker compose down
. Do that now, and then we'll look at some of the settings in docker_compose.yaml
, which is the file that tells docker how to configure the containers.
docker_compose.yaml
I can't really provide settings for your LAN, but chances are they're similar to what's in the compose file already. That said, one major change I had to make was changing the network driver to ipvlan
instead of macvlan
- for some reason my network hardware doesn't like macvlan
and I couldn't see the containers on the network. The networks section of the file will look something like this:
networks:
default:
driver: ipvlan
driver_opts:
parent: ${NETWORKINTERFACE:-wlp3s0}
ipam:
config:
- subnet: ${IPPREFIX:-192.168.0}.0/24
Note: wlp3s0
is the name of the WiFi connection on my Macbook when running Ubuntu, find yours using ifconfig
or similar, and ensure the subnet matches your network configuration too. Most home routers configure the local network to use 192.168.0.x
or 192.168.1.x
.
After the generic section of the file you'll see two blocks for servers, with examples of settings for game mode and the like. Each server will need an IP address for your network, so be sure to put in a value that's legitimate and free for your LAN. Again, I can't tell you what your network configuration is, but hopefully if you're doing this you're already comfortable with tools such as ifconfig
. Using the subnet above, the first server block would look something like this:
minecraft1:
<< : *default-mcserver
environment:
WORLD: family
MCPROP_SERVER-NAME: "Creative World"
MCPROP_GAMEMODE: 1 # 0 is survival, 1 is creative, 2 is adventure
MCPROP_ENABLE-LAN-VISIBILITY: true
container_name: minecraft1
networks:
default:
# Be sure the last three digits of IP address is unique
ipv4_address: ${IPPREFIX:-192.168.0}.20
After editing the file, either restart or start the servers as required:
docker compose up -d
# or
docker compose restart
At this point, depending on the hardware you're playing on, you could well be good to go. On PC (and Android) under the servers tab in the game, there's an option to add a custom server. Adding the IP addresses you assigned in the yaml config file here should be all you need to do. If the containers are up they should be available on your network on the standard Minecraft port 19132.
I spent a day or two trying to work out how I could get these shiny new servers to appear in the Friends List on the XBox my son plays on. There's no way to add a server in the server list, and unlike the server I ran directly before embarking on this adventure, the new ones didn't show in the Friends list, meaning he couldn't join. I still don't know the exact reason why they don't share in there, but I suspect it's to do with UDP packet delivery between the virtual network of the container and my physical LAN. Anyway, I eventually tripped over Putmatt's BedrockConnect which is designed to solve this exact problem. It really goes further than I need, so here I'll boil it down to the few steps needed to get a Switch/Xbox showing your new serves in the Friends list.
The Minecraft clients for these platforms get a list of servers from a special server, and essentially we can hijack this process by running our own DNS server for the console to use, redirecting it's requests to yet another Docker container that provides the console with our own list of game servers. Puggmatt provides a setup script for the DNS server in his setup instructions.
Warning!! It's never a great idea to just run random shell scripts from the internet without reading them first. I read it, felt ok with it and proceeded. I do suggest reading it first for the sake of sanity, not least because you need to run it with
sudo
.
Download the script (you might need to run sudo apt install wget
if it's not already installed) and run it using the IP addess of the machine you're setting this all up on, i.e. the one running the Docker containers. The process will look something like this:
wget https://raw.githubusercontent.com/Pugmatt/BedrockConnect/master/scripts/install-bind.sh
chmod 755 ./install-bind.sh
sudo install-bind.sh 192.168.0.10
Now to run BedrockConnect itself I also wanted to use a container for convenience, and quickly found straussman's container repo to do just that. The README on the repo lists a few options for running it, I went for a using docker compose
again for consistency, and the process was quite straight forward, requiring just the config file (as provided) and a short JSON file listing my two custom servers.
mkdir bedrock_connect
cd bedrock_connect
mkdir config
In the bedrock_connect
directory, use the editor of your choice to create a file called docker-compose.yaml
with the following contents:
---
services:
bedrockconnect:
image: strausmann/minecraft-bedrock-connect:2
restart: always
environment:
- NODB=true
- CUSTOM_SERVERS=/config/serverlist.json
- SERVER_LIMIT=25
ports:
- 19132:19132/udp
volumes:
- bedrockconnect:/config
volumes:
bedrockconnect:
driver: local
The in the config directory create a file called serverlist.json
where you can list the two servers you created using their IP addresses (last time I labour this point, but the IPs below are just an example - adjust as required!):
[
{
"name": "Local Server - Creative",
"iconUrl": "https://i.imgur.com/nhumQVP.png",
"address": "192.168.0.20",
"port": 19132
},
{
"name": "Local Server - Survival",
"iconUrl": "https://i.imgur.com/nhumQVP.png",
"address": "192.168.0.21",
"port": 19132
}
]
With this done, bedrock_connect can be started using the same command as before (in the right directory of course!):
docker compose up -d
The final step is to point your Switch/XBox at the DNS server created by the shell script. On the XBox the DNS settings are under the Advanced box under network settings. For the primary use the IP of your server that you provided to the script (192.168.0.10 in the example above), then set the secondary to a public one, such as 1.0.0.1. With that done, launch the game and if everything's gone to plan you should now see your two Bedrock servers showing under the Friend's tab!