How To Host A DIY Minecraft Server At Home With Docker

From Doku Wiki
Jump to: navigation, search

My oldest child recently got into Minecraft. My son, on the other hand plays 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 looked into running a Dockerized Minecraft server on my home server, and it was much easier than I expected.



Running a dedicated server



The official server distribution is only a single Java jar, which means it should be simple to run. minecraft hunger games servers Before trying it, though, I searched for Docker images, and found a good one: itzg/minecraft-server.



You can either start the container with a docker run command or daemonize it. However, I've kept it simple by using docker compose in a byobu session.



Here's my current docker-compose.yml file:



There are many possible configuration options, however I'd like to focus on two things above:



- Game's persistent data are stored on a volume that is mounted on the host. This lets us easily access the files. The "WORLD" option is really handy for importing a save that was first created on another computer.



Connecting to the Server



The server will be able to accept connections in a few seconds. However my clients aren't in a position to see it. Minecraft will remain on the "Scanning games on your local network" screen for the rest of time. Whatever the case the reason, you can "Add Server" to add it manually, and voila!



Web Map



My Minecraft knowledge is a decade old. However, I'm aware that third-party tools can create a web view of a Minecraft world, similar to the one in Google Maps. After doing some research it appears that Minecraft Overviewer is the prominent one of the moment.



Although the installation of this tool is straightforward, I found a Docker file that was easier to install. This is a one-shot procedure (not an ongoing service), so we'll make use of docker run:



Leaflet will create a web map with 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, for example /var/www/public_html, for ease of access from any web browser.



It takes a few minutes to run, but the results are pretty impressive:



Makefile



As is my habit I added some shortcuts into the Makefile to make it easy to access:



Reasons You Might Want to build Dockerized Minecraft Server



Most people don't need an individual server. If you're just looking for a way to play locally and one of your machines is quite powerful, you can click "Open to LAN" from inside the game. If you're looking to play with a larger number of players outside of your household You're better off with a paid hosted server. This could be the official "Realms" or one of the many third-party alternatives.