How To Host A DIY Minecraft Server At Home With Docker

From AI Knowledge
Revision as of 19:41, 24 June 2022 by Birdshake08 (talk | contribs) (Created page with "<p> My oldest son recently jumped into Minecraft. My son, on the other hand is playing Bedrock Edition on an iPad and an arcade game console. He prefers Java Edition on an old...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

My oldest son recently jumped into Minecraft. My son, on the other hand is playing 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 decided to run an Dockerized Minecraft server on my home server, and it was much easier than I expected. System32



Running a Dedicated Server



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



You can start the container using a single docker run command and/or daemonize it. I prefer to keep it simple and use docker compose within my byobu session.



Here's my current docker.yml file. System32



There are many configuration options available however I would like to highlight two:



The game's data that is persistent is written to a disk that is mounted to the host, to allow us to easily 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, but my clients can't see it for some reason. Minecraft will be on the "Scanning for games on your local network" screen for the rest of the time. You can "Add Server" to manually add it, and voila!



Web Map



The majority of my Minecraft knowledge is more than a decade old. But, I'm aware that third-party tools can generate a web view of a Minecraft world that is similar to the ones in Google Maps. It seems that Minecraft Overviewer is the most popular tool nowadays.



Like I said, this tool's installation is pretty simple however, I came across an Docker image that's even easier. This is a single-shot process (not an ongoing service), so we'll use 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 then be connected to a web-served directory on the host like the /var/www directory or /public_html to allow access via any browser.



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



Makefile



Finally, as is my wont I added several shortcuts in the Makefile to make it easy to access:



The Reasons to Build a Dockerized Minecraft Server



A DIY dedicated server is probably not necessary for the majority of players. If you are just wanting to play locally using multiplayer and your computer is sufficiently powerful, you can simply "Open to LAN" directly from the game. A paid hosted server is best if you wish to play with a larger number of people outside your home. This could be the official "Realms", or one of the many third-party alternatives. System32