How To Host A DIY Minecraft Server At Home Using Docker

How To Host A DIY Minecraft Server At Home Using Docker


My oldest son recently jumped into Minecraft. While his peers play Bedrock Edition on an iPad or game console, my son plays the venerable Java Edition on an old computer. He can launch it using his terminal! ) To play together I thought about running an Dockerized Minecraft server on my home server, and it was much easier than I expected.

Running a dedicated server

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

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

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

There are a variety of configuration options however I'd like to focus on two of them:

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

Connecting to the Server

After a few 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" screen for the rest of time. No matter you want to do, simply click "Add Server" to add it manually, and voila!

Web Map

My Minecraft knowledge is more than a decade old. However, Rock It Like A Hurricane 'm aware of third-party tools can generate a web view of a Minecraft world that is similar to the ones in Google Maps. After a bit of research it appears that Minecraft Overviewer is the prominent one of the moment.

Although the installation process is easy, I discovered an Docker file that was easier to install. This one's a one-shot process (not an ongoing service), so we'll make use of 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 can be symlinked into a web-served directory on the host such as the /var/www directory or /public_html to allow access via any browser.

Even though it only takes just a few minutes but the results are impressive.

Makefile

As per my own wishes, I added a few shortcuts to a Makefile to make it easier to access.

The Reasons to build Dockerized Minecraft Server

A dedicated server built by yourself is probably unnecessary for most players. If you're just looking for a way to play multiplayer locally and one of your computers is quite powerful, you can click "Open to LAN" from inside the game. A paid hosted server is more suitable when you wish to play with a bigger number of people outside your home. This could be the official "Realms" or any of several third-party alternatives.

Report Page