How To Host A DIY Minecraft Server At Home With Docker

From SEDS-USA Wiki
Jump to navigation Jump to search

My oldest child was introduced to Minecraft recently. While many of his peers play Bedrock Edition on an iPad or game console, my son plays the venerable Java Edition on an old computer. (And he can launch it via the terminal! ) To play with each other I thought about running an Dockerized Minecraft server on my home server and it was easier than I expected.

Running a Dedicated Server

The official server distribution includes a single 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 either fire up the container using the docker run command, or daemonize it. I prefer to keep it simple and run docker compose in my byobu session.

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

There are many configuration options to choose from, but I'd like to focus on two points above:

The game's persistent data is written to a volume connected 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

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

Web Map

Most of my Minecraft knowledge is more than a decade old. But, I'm aware that third-party tools can produce an online view of the Minecraft world that is similar to the ones in Google Maps. It seems that Minecraft Overviewer is the most popular tool nowadays.

As I mentioned before, the installation is pretty simple, but I found a Docker image that's a lot easier. This is a one-shot (not permanent) procedure, so we'll use 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. The directory is then linked to a web-served directories on the host, such as /var/www or ~/public_html for access to any web browser.

While it only takes a few minutes, the results are quite impressive.


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

Reasons You Might Want to build a Dockerized Minecraft Server

Most people don't need an individual server. If you're just looking for a way to play multiplayer locally and one of your machines is fairly powerful, you can click "Open to LAN" within the game. A paid hosted server is best when you wish to play with a greater amount of players from outside your home. It could be the official "Realms" or one of the many third-party alternatives.