How To Host A DIY Minecraft Server At Home Using Docker

From Wifi Adapters DB
Jump to: navigation, search

My oldest child recently got into Minecraft. Mini Blog is the opposite. He, plays Bedrock Edition on an iPad and an arcade game console. He prefers Java Edition on an older computer. He launches it via his terminal! ) To play with each other, I looked into running a Dockerized Minecraft server on my home server, and it was much more straightforward than I anticipated.



A dedicated server is running



The official server distribution comes with only one Javajar. It should be simple to use. Before trying it, though, I searched for Docker images, and found a good one: itzg/minecraft-server.



You can start the container by using an individual docker run command or daemonize it. I prefer to keep it simple and use docker compose up in my byobu session.



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



There are many configuration options, but I would like to highlight two options:



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



Connecting to the Server



The server will be able to accept connections in a few seconds. However my clients aren't able to see it. Minecraft will sit on the "Scanning for games on your local network" screen forever. You can "Add Server" to manually add it, and voila!



Web Map



Most of my Minecraft knowledge is a decade out of date. However, I'm aware that third-party tools can create an online representation of a Minecraft world that is similar to the ones in Google Maps. It appears that Minecraft Overviewer is the most well-known tool in the market today.



As before, this tool's installation looks pretty straightforward but I discovered an Docker image that's even simpler. This one's a one-shot process (not an ongoing service) So we'll make use of docker run:



Given read-only access to the game data generated by the other container, and another volume to write to, this will result in an online map using Leaflet. This directory can be symlinked to a web-served directories on the host, such as the /var/www/public_html directory, which allows easy access from any web browser.



Although it takes only just a few minutes to complete however, the results are impressive.



Makefile



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



The Reasons to build Dockerized Minecraft Server



Most people don't need a dedicated server. If you are just looking to play locally with multiplayer and one of your computers is powerful enough, you can simply "Open to LAN" directly from the game. A paid hosted server is more suitable when you wish to play with a greater number of people outside your home. This could be the official "Realms" or any of several third-party alternatives.