How To Host A DIY Minecraft Server At Home With Docker

From World History
Revision as of 20:31, 25 June 2022 by Hoeconga09 (talk | contribs) (Created page with "<p> My oldest child discovered Minecraft recently. My son however plays Bedrock Edition on an iPad and an arcade game console. He prefers Java Edition on an older computer. (A...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

My oldest child discovered Minecraft recently. My son however plays Bedrock Edition on an iPad and an arcade game console. He prefers Java Edition on an older computer. (And he can launch it via the terminal! ) To play together, I looked into running an Dockerized Minecraft server on my home server and it was simpler than I had expected.



A dedicated server is running



The server distribution that is officially available is 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 open the container with the docker run command, or daemonize it. I prefer to keep it simple and set docker compose in my byobu session.



Here's my current docker.yml file.



There are tons of possible configuration options, however I'd like to highlight two things above:



Game's persistent files are written to a disk that is mounted on the host. This allows us to quickly access the files. The "WORLD" option is useful to import a save that was first created on another computer.



Connecting to the Server



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



Web Map



My Minecraft knowledge is more than a decade old. But, I'm aware that third-party tools can generate an online view of the Minecraft world similar to those in Google Maps. Soundzpromising After doing some research, it seems like Minecraft Overviewer is the prominent one these days.



Like I said, this tool's installation is pretty simple, but I found an Docker image that's even simpler. This is a single-shot (not an ongoing) process so we'll use docker to 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 is then connected to a web-served directory on the host, such as the directory /var/www or /public_html, which can be to any web browser.



It takes just a few minutes to complete and the results are pretty spectacular:



Makefile



As per my will I added some shortcuts to a Makefile for quick access.



Reasons You Might Want to build a Dockerized Minecraft Server



A DIY dedicated server is probably not necessary for the majority of players. If you're looking to play local multiplayer and your computer is powerful enough, you can simply "Open to LAN" directly from the game. A paid hosted server is better if you would like to play with a bigger number of people outside your home. It could be the official "Realms" or one of several third-party alternatives.