How To Host A DIY Minecraft Server At Home With Docker

From AI Knowledge
Jump to: navigation, search

My oldest child recently got into Minecraft. While a lot of his friends play Bedrock Edition on an iPad or game console, my son plays the venerable Java Edition on an old computer. (And it's launched from the terminal! ) To play together I decided to run an Dockerized Minecraft server on my home server and it was more straightforward than I anticipated.



Running a dedicated server



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



You can fire up the container using a single docker run command or daemonize it. But, I've been keeping it simple by setting docker compose up in a byobu session.



Here's my current docker.yml file



There are a variety of configuration options to choose from however I'd like to mention two:



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



Connecting to the Server



After a couple of seconds, the server is ready to accept connections, but my clients aren't able to recognize it for some reason. Minecraft will sit on the "Scanning for games on your local network" screen for the rest of the time. Fun Gallery want to do, simply click "Add Server" to add it manually, and voila!



Web Map



The majority of my Minecraft knowledge is a decade out of date. But, I'm aware that third-party tools can create an online representation of a Minecraft world, similar to the one in Google Maps. After searching around it appears that Minecraft Overviewer is the prominent one in the present.



Like I said, this tool's installation looks pretty straightforward however, I came across an Docker image that's a lot easier. This is a single-shot (not an ongoing) process so we'll use docker ran:



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. This directory can be linked to a web-served directories on the host, such as /var/www/public_html, for easy access from any internet browser.



It takes only a few minutes to complete and the results are quite impressive:



Makefile



Finally, as is my custom, I threw several shortcuts in the Makefile to make them easy to access:



Motives to build Dockerized Minecraft Server



Most people don't require an individual server. If you're just looking to play locally with multiplayer and one of your computers is powerful enough it is possible to "Open to 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. This could be the official "Realms" or one of the many third-party options.