How To Host A DIY Minecraft Server At Home Using Docker

From Imoodle
Jump to: navigation, search

My oldest child discovered Minecraft recently. My son is the opposite. He is playing 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 decided to run an Dockerized Minecraft server on my home server, and it was much more straightforward than I anticipated. MINECRAFT PARKOUR SERVERS



Running a dedicated server



The server distribution that is officially available is a single Java jar, so 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 open the container using the docker run command or daemonize it. I prefer to keep it simple and run docker compose up in my byobu session. MINECRAFT PARKOUR SERVERS



Here's my current docker.yml file.



There are many configuration options however I'd like to focus on two options:



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



Connecting to the Server



After a few seconds the server is ready to accept connections, but my clients don't seem to recognize it for some reason. Minecraft will remain on the "Scanning for games on your local network" screen forever. You can still "Add Server" to manually add it, and voila!



Web Map



My Minecraft knowledge is more than a decade old. Third-party tools can create a web view of a Minecraft environment, similar to Google Maps. After a bit of research, it seems like Minecraft Overviewer is the prominent one in the present.



As I mentioned before, the installation is pretty simple but I discovered an Docker image that's even simpler. This is a one-shot (not permanent) procedure, so we'll be using docker to run:



Leaflet will create a map on the web 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 like the directory /var/www or /public_html, which can be via any browser.



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



Makefile



In the end, in line with my wishes I added a few shortcuts to a Makefile for quick access.



Motives to Build a Dockerized Minecraft Server



A DIY dedicated server is probably unnecessary for most people. If you're just looking for a way to play locally and one of your machines is reasonably powerful, you can click "Open to LAN" within the game. A paid hosted server is better for those who want to play with a bigger number of players outside of your home. It could be the official "Realms" or one of the numerous third-party alternatives.