How To Host A DIY Minecraft Server At Home With Docker

From Bot's DB
Jump to: navigation, search

My oldest son recently jumped into Minecraft. While many of his peers play Bedrock Edition on an iPad or game console, my son plays the old-fashioned Java Edition on an old computer. He launches it from his terminal! ) To play with each other I decided to run a Dockerized Minecraft server on my home server, and it was much simpler than I had expected.



A dedicated server is running



The official server distribution is only a single Java jar, so it should be 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 and/or daemonize it. I prefer to keep it simple and set docker compose within my byobu session.



Here's my current docker.yml file



There are tons of configuration options to choose from, but I'd like to emphasize two things that I mentioned above:



The game's persistent data is written to a disk mounted to the host so that we can access the files. The "WORLD" option allows you to import a save that was created on a different computer.



Connecting to the Server



After a couple of seconds, the server is now ready to accept connections, but my clients aren't able to be able to see it due to reasons. Minecraft will be on the "Scanning for games on your local network" screen for the rest of the time. You can "Add Server" to manually add it, and voila!



Web Map



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



While the installation of this tool is simple, I came across an Docker file that was even simpler. top top blog This is a one-shot (not permanent) procedure, so we'll use docker run:



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. The directory is then symlinked into a web-served directory on the host, such as /var/www or ~/public_html for access from any web browser.



Although it takes only just a few minutes to complete but the results are impressive.



Makefile



As is my wont I added some shortcuts into an Makefile to make it easy to access:



Reasons You Might Want to build Dockerized Minecraft Server



Most people don't require an individual server. If you're just looking for a way to play locally and one of your computers is fairly powerful, you can just "Open to LAN" from inside the game. A paid hosted server is more suitable for those who wish to play with a larger number of players outside of your home. That could be either the official "Realms" or one of several third-party options.