HOW TO HOST A DIY MINECRAFT SERVER AT HOME USING DOCKER



My oldest child was introduced to Minecraft recently. My son is the opposite. He is playing Bedrock Edition on an iPad and a game console. He prefers Java Edition on an older computer. (And he can launch it via the terminal! ) To play together I thought about running a Dockerized Minecraft server on my home server, and it was much easier than I expected.



Operating a dedicated server



The official server distribution includes a single Javajar. It's likely to be simple to use. Before trying it, though, I searched for Docker images, and found a good one: itzg/minecraft-server.



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



Here's my current docker.yml file.



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



- The game's persistent data is stored on a volume mounted to the host to allow us to easily access the files. The "WORLD" option allows you to import a save that was made on a different computer.



Connecting to the Server



After a few seconds the server is now ready to accept connections, but my clients aren't able to see it for some reason. Minecraft will remain on the "Scanning games on your local network" screen for as long as. No matter, you can "Add Server" to add it manually, and voila!



Web Map



My Minecraft knowledge is a decade old. Third-party tools can provide an online view of the Minecraft environment similar to Google Maps. It appears that Minecraft Overviewer is the most popular tool nowadays.



Although the installation of this tool is straightforward, I found an Docker file that was simpler. This is a one-shot (not a persistent) process so we'll use docker ran:



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



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



Makefile



As is my habit, I threw some shortcuts into a Makefile for easy access:



Reasons You Might Want to Build Dockerized Minecraft Server



Most people don't require dedicated servers. If you are just looking to play local multiplayer and one of your computers is sufficiently powerful you can click "Open to the LAN" directly from the game. A paid hosted server is best if you would like to play with a bigger number of people outside your home. Minecraft survival servers could be the official "Realms" or one of the many third-party options.


Created: 11/07/2022 01:19:18
Page views: 123
CREATE NEW PAGE