My oldest son discovered Minecraft recently. My son however plays Bedrock Edition on an iPad and a game console. He prefers Java Edition on an older computer. He launches it via his terminal! ) To play with each other, I looked into running a Dockerized Minecraft server on my home server and it was more straightforward than I anticipated.
Operating a dedicated server
The official server distribution includes a single Javajar. It should be easy to use. Before trying it, though, I searched for Docker images, and found a good one: itzg/minecraft-server.
system32
You can start the container by using an individual docker run command, or daemonize it. I prefer to keep it simple and run docker compose in my byobu session.
Here's my current docker-compose.yml file:
There are a ton of possible configuration options, however I'd like to emphasize two things that I mentioned above:
- Game's persistent data are written to a volume that is mounted on the host. This lets us quickly access the files. The "WORLD" option allows you to import a save created on another computer.
Connecting to the Server
After a few seconds the server is now ready to accept connections, but my clients can't be able to see it due to some reason. Minecraft will remain on the "Scanning games on your local network" screen for the rest of time. You can "Add Server" to manually add it, and voila!
Web Map
The majority of my Minecraft knowledge is about a decade old. However, I'm aware that third-party tools can produce an online representation of a Minecraft world, similar to the one in Google Maps. After a bit of research it appears that Minecraft Overviewer is the prominent one of the moment.
Although the installation process is simple, I came across an Docker file that was more simple. This is a one-shot (not permanent) procedure, so we'll use docker to run:
Leaflet will create a web map that has read-only access to game data from the other container, and another volume to write it to. The directory can then be linked to a web-served directories on the host such as the directory /var/www or /public_html, which can be to any web browser.
It takes a few minutes to run but the results are pretty impressive:
Makefile
Lastly, as is my habit I added a few shortcuts in an Makefile to make them easy to access:
Motives to build a Dockerized Minecraft Server
A DIY dedicated server is probably not necessary for the majority of people. If you're just looking to play locally and one of your machines is reasonably powerful, you can simply "Open to LAN" within the game. If you're looking to play with a larger group of players outside of your household it's best to go with a paid-for hosted server. This could be the official "Realms", or any of several third-party alternatives.
system32
system32
Log in to comment