- Member Since: July 17, 2022
How To Host A DIY Minecraft Server At Home With Docker
My oldest son recently jumped into Minecraft. My son however plays Bedrock Edition on an iPad and a game console. He prefers Java Edition on an older computer. He launches it via his terminal! ) To play with each other I decided to run a Dockerized Minecraft server on my home server, and it was much more straightforward than I anticipated.
Operating a dedicated server
The official server distribution comes with only one Javajar. It's likely to 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 and/or daemonize it. I prefer to keep it simple and use docker compose within my byobu session.
Here's my current docker-compose.yml file:
There are a variety of configuration options, but I'd like to focus on two options:
- Game's persistent data are written to a volume mounted on the host. This lets us easily access the files. - The "WORLD" option is useful to import the save file that was originally created on another computer.
Connecting to the Server
The server will accept connections within a few seconds. However my clients aren't in a position to see it. Minecraft will remain on the "Scanning games on your local network" screen for the rest of time. However you want to do, simply click "Add Server" to add it manually, and voila!
Most of my Minecraft knowledge is a decade out of date. Third-party tools can produce web-based views of the Minecraft environment, similar to Google Maps. It seems that Minecraft Overviewer is the most popular tool nowadays.
While the installation process is straightforward, I found a Docker file that was easier to install. This is a one-shot procedure (not a persistent service) We'll make use of docker run:
With read-only access to game data generated by the other container, and another volume to write to, this will produce a web map using Leaflet. The directory can be symlinked into a web-served directory on the host such as the /var/www directory or /public_html to allow access via any browser.
It takes a few minutes to complete, but the results are quite impressive:
Finally, as per my will I added some shortcuts to a Makefile to make it easier to access.
The Reasons to build Dockerized Minecraft Server
A dedicated server built by yourself is probably not necessary for the majority of people. If you're just looking to play locally with multiplayer and one of your computers is powerful enough you can click "Open to the LAN" directly from the game. A paid hosted server is best if you would like to play with a larger amount of players from outside your home. mcprofile This could be the official "Realms" or one of the many third-party options.