HOW TO HOST A DIY MINECRAFT SERVER AT HOME WITH DOCKER


My oldest son recently jumped into Minecraft. While his peers play Bedrock Edition on an iPad or game console, my son plays 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 more straightforward than I anticipated.



A dedicated server is running



The official server distribution comes with only one Javajar. It should be simple to use. Before trying it, though, I searched for Docker images, and found a good one: itzg/minecraft-server.



You can either fire up the container by using the docker run command or daemonize it. I prefer to keep it simple and set docker compose up in my byobu session.



Here's my current docker.yml file



There are many configuration options to choose from, but I'd like to focus on two of them:



- Game's persistent data are written to a disk mounted on the host. This allows us to easily access the data. The "WORLD" option is useful for importing a save that was first created on a different computer.



Connecting to the Server



After a few seconds the server is ready to accept connections, but my clients aren't able to 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. 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 10 years old. Third-party tools can create a web view of the Minecraft environment that is similar to Google Maps. After doing some research it appears that Minecraft Overviewer is the prominent one in the present.



As before, this tool's installation appears fairly straightforward however, I came across a Docker image that's even simpler. This is a single-shot process (not a persistent service) So we'll make use of docker run:



With read-only access to game data created by the other container, and another volume to write to, this will create an online map using Leaflet. This directory can be symlinked to a web-served directory on the host, such as the directory /var/www/public_html for easy access from any internet browser.



It takes just a few minutes to run but the results are pretty spectacular:



Makefile



Lastly, as is my custom I threw in a few shortcuts in an Makefile for easy access:



Motives to Build a Dockerized Minecraft Server



A dedicated server built by yourself is probably not needed by the majority of people. If MODDED MINECRAFT SERVERS looking to play locally and one of your machines is quite powerful, you can just "Open to LAN" within the game. A paid hosted server is better for those who would like to play with a greater number of players outside of your home. This could be the official "Realms", or any of several third-party options.


Created: 17/07/2022 09:35:27
Page views: 56
CREATE NEW PAGE