How To Host A DIY Minecraft Server At Home With Docker

· 2 min read
How To Host A DIY Minecraft Server At Home With Docker


My oldest child recently got into Minecraft. While his peers play Bedrock Edition on an iPad or game console, my son is playing the old-fashioned Java Edition on an old computer. He can launch it using his terminal! ) To play together I decided to run an Dockerized Minecraft server on my home server, and it was much easier than I expected.



Operating a dedicated server



The official server distribution is one Java jar, so it should be fairly easy to run. Before trying it, though, I searched for Docker images, and found a good one: itzg/minecraft-server.



You can fire up the container with an individual docker run command, or daemonize it. I prefer to keep it simple and use docker compose within my byobu session.



Here's my current docker.yml file.



There are a ton of available configuration options, but I'd like to focus on two things that I mentioned above:



- The game's persistent data is written to a disk connected to the host so that we can access the files.  The "WORLD" option is useful to import the save file that was originally created on another computer.



Connecting to the Server



The server will allow connections within a few seconds. However  https://ejac.org/  aren't in a position to see it. Minecraft will sit on the "Scanning for games on your local network" screen for the rest of the time. You can still "Add Server" to manually add it, and voila!



Web Map



My Minecraft knowledge is more than a decade old. However, I'm aware that third-party tools can create an online view of the Minecraft world, similar to the one in Google Maps. After searching around it appears that Minecraft Overviewer is the prominent one of the moment.



While the installation process is straightforward, I found an Docker file that was more simple. This is a single-shot (not permanent) procedure, so we'll be using docker ran:



Given read-only access to the game data generated by the other container and another volume to write to, this will result in a web map using Leaflet. This directory can be symlinked to a web-served directory on the host, for example /var/www/public_html, for easy access from any internet browser.



While it only takes just a few minutes, the results are quite impressive.



Makefile



As per my will, I added some shortcuts to a Makefile for quick access.



Motives to Build a Dockerized Minecraft Server



A DIY dedicated server is probably not needed by the majority of people. If you're just looking to play locally with multiplayer and your computer is sufficiently powerful, you can simply "Open to LAN" directly from the game. If you're looking to play with a larger number of people outside your home it's best to go with a paid-for hosted server. It could be the official "Realms" or one of the numerous third-party alternatives.