How To Host A DIY Minecraft Server At Home With Docker

From Morphomics
Jump to: navigation, search

My oldest son discovered Minecraft recently. My son, on the other hand plays Bedrock Edition on an iPad and an arcade game console. He prefers Java Edition on an older computer. (And he launches it from the terminal! ) To play together, I looked into running an Dockerized Minecraft server on my home server and it was easier than I expected.



A dedicated server is running



The official server distribution is a single Java jar, so it ought to be pretty easy to run. Before trying it, though, I searched for Docker images, and found a good one: itzg/minecraft-server.



You can either open the container by using the docker run command, or daemonize it. I prefer to keep it simple and use docker compose in my byobu session.



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



There are many configuration options available However, I'd like to mention two:



- Game's persistent data are written to a disk that is mounted on the host. This allows us to easily access the files. Minecraft servers The "WORLD" option lets you import a save created on a different computer.



Connecting to the Server



The server will allow connections within a few seconds. However, my clients aren't able to see it. Minecraft will remain on the "Scanning games on your local network screen" screen for as long as. Whatever the case the reason, you can "Add Server" to add it manually, and voila!



Web Map



The majority of my Minecraft knowledge is more than 10 years old. However, I'm aware of third-party tools can generate an online representation of a Minecraft world, similar to the one in Google Maps. It appears that Minecraft Overviewer is the most popular tool these days.



As before, this tool's installation looks pretty straightforward however, I came across a Docker image that's even easier. 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 created by the other container, and another volume to write to, this will result in an online map using Leaflet. The directory can then be linked to a web-served directories on the host such as the directory /var/www or /public_html, which can be via any browser.



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



Makefile



As is my habit I threw in some shortcuts into an Makefile for easy access:



Motives to Build a Dockerized Minecraft Server



A DIY dedicated server is probably unnecessary for most players. If you're just looking for a way to play multiplayer locally and one of your machines is quite powerful, you can just "Open to LAN" within the game. A paid hosted server is best for those who want to play with a greater number of players outside of your home. This could be the official "Realms" or any of several third-party options.