How To Host A DIY Minecraft Server At Home With Docker

From Valentino Fans
Jump to: navigation, search

My oldest son recently jumped into Minecraft. While many of his peers play Bedrock Edition on an iPad or game console, my son is playing the classic Java Edition on an old computer. (And he launches it from the terminal! ) To play with each other I thought about running a Dockerized Minecraft server on my home server, and it was much easier than I expected.



A dedicated server is running



The official server distribution is a single Java jar, so it should be fairly 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 using 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-compose.yml file:



There are many configuration options to choose from, but I'd like to emphasize two things that I mentioned above:



- The game's persistent data is written to a disk that is mounted to the host, to allow us to easily access the files. The "WORLD" option is really handy for importing a save that was first created on another computer. Cubepack88



Connecting to the Server



After a few seconds the server is ready to accept connections, however my clients can't see it for reasons. Minecraft will remain on the "Scanning games on your local network" screen for the rest of time. Whatever the case, you can "Add Server" to add it manually, and voila!



Web Map



My Minecraft knowledge is a decade old. But, I'm aware that third-party tools can produce an online representation of a Minecraft world similar to those in Google Maps. After doing some research it appears that Minecraft Overviewer is the prominent one in the present.



While the installation of this tool is straightforward, I found an Docker file that was easier to install. This is a one-shot procedure (not a persistent service) We'll use docker 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 can be linked to a web-served directories on the host like the /var/www directory or /public_html to allow access from any web browser.



Even though it only takes just a few minutes however, the results are impressive.



Makefile



In the end, in line with my will I added a few shortcuts to the Makefile to make it easier to access.



Reasons You Might Want to Build a Dockerized Minecraft Server



Most people don't require a dedicated server. If you're just looking for a way to play multiplayer locally and one of your machines is reasonably powerful, you can just "Open to LAN" within the game. Another Day Another Cube A paid hosted server is more suitable for those who wish to play with a bigger number of people outside your home. This could be the official "Realms" or one of the many third-party options.

Another Day Another Cube