How To Host A DIY Minecraft Server At Home With Docker

How To Host A DIY Minecraft Server At Home With Docker


My oldest child discovered Minecraft recently. While many of his peers play Bedrock Edition on an iPad or game console, my son plays the classic Java Edition on an old computer. He can launch it using his terminal! ) To play with each other, I looked into running an Dockerized Minecraft server on my home server and it was simpler than I had expected.

Running a Dedicated Server

The official server distribution includes only one 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 with the docker run command or daemonize it. I prefer to keep it simple and run docker compose within my byobu session.

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

There are many configuration options however I'd like to mention two of them:

The game's data that is persistent is written to a volume connected to the host so that we can access the files. The "WORLD" option lets you import a save that was created on another computer.

Connecting to the Server

After a couple of seconds, the server is now ready to accept connections, however my clients don't seem to see it for some reason. Minecraft will remain on the "Scanning games on your local network" screen for as long as. You can still "Add Server" to manually add it, and voila!

Web Map

The majority of my Minecraft knowledge is 10 years old. However, I'm aware of third-party tools can produce an online view of the Minecraft world, similar to the one in Google Maps. It seems that Minecraft Overviewer is the most well-known tool in the market today.

While the installation of this tool is simple, I came across a Docker file that was even more simple. This one's a one-shot process (not a persistent service) So we'll make use of docker run:

If you have read-only access to the game data generated by the other container and another volume to write to, this will produce a web map using Leaflet. This directory could be linked to a web-served directories on the host, for example the /var/www/public_html directory, which allows easy access from any internet browser.

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

Makefile

Finally, as is my custom I added some shortcuts into an Makefile to make it easy to access:

Motives to Build Dockerized Minecraft Server

A dedicated server built by yourself is probably not needed by the majority of people. If you're just looking to play multiplayer locally and one of your computers is quite powerful, you can just "Open to LAN" within the game. If you're planning to play with a larger number of people outside your home You're better off with a paid hosted server. Minecraft servers could be either the official "Realms" or one of the numerous third-party options.

Report Page