HOW TO HOST A DIY MINECRAFT SERVER AT HOME WITH DOCKER



My oldest child discovered Minecraft recently. Hunter My son is the opposite. He is playing Bedrock Edition on an iPad and an arcade game console. He prefers Java Edition on an older computer. He launches it from his terminal! ) To play together, I looked into running an Dockerized Minecraft server on my home server, and it was much simpler than I had expected.



Running a Dedicated Server



The server distribution that is officially available is a single 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 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 many available configuration options, but I'd like to emphasize two points above:



- Game's persistent data are written to a volume that is mounted on the host. This allows us to easily access the data. The "WORLD" option allows you to import a save created on a different computer.



Connecting to the Server



After a couple of seconds, the server is ready to accept connections, however my clients can't see it for some reason. Minecraft will sit on the "Scanning for games on your local network" screen for a long time. No matter you want to do, simply click "Add Server" to add it manually, and voila!



Web Map



The majority of my Minecraft knowledge is a decade old. But, I'm aware that third-party tools can generate a web view of a Minecraft world that is similar to the ones in Google Maps. It seems that Minecraft Overviewer is the most popular tool these days.



Although the installation process is simple, I came across an Docker file that was easier to install. This one's a one-shot process (not an ongoing service), so we'll use docker run:



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



It takes just a few minutes to run and the results are quite impressive:



Makefile



In the end, in line with my wishes, I added a few shortcuts to a Makefile for quick access.



Reasons You Might Want to build a Dockerized Minecraft Server



Most people don't require a dedicated server. If you are just looking to play local multiplayer and one of your computers is powerful enough, you can simply "Open to the LAN" directly from the game. If you're looking to play with a larger number of folks outside your household, you're probably better off with a paid hosted server. This could be the official "Realms" or one of the many third-party options.


Created: 27/06/2022 16:30:14
Page views: 12
CREATE NEW PAGE