Hosting a Minecraft server
I have never been much of a gamer, but both my kids (5 & 10) enjoy playing Minecraft on their iOS devices. They often play together in shared worlds, so with the recent stay-at-home orders due to COVID-19, I decided it was finally time to set them up with a proper Minecraft server. This arrangement obviously allows for better individual access to a shared world even when the other person is not available to play. Overall, I found the setup to be much easier than anticipated and it has even contributed to some quality family playtime. So if you have been thinking about creating your own Minecraft server my docker compose file is available below to help get you started.
Relevant Information:
- I am using the Bedrock Edition of Minecraft. This is specifically designed to support play by multiple device types (Xbox, Windows, iOS, Android, etc). There is another version (‘the original’) which is Java based and is primarily for Windows only.
- Also note, I am using Geoff Bourne’s Bedrock Server image (thanks Geoff!). His Github repo is here and is worth a read over for more config and options detail. There are also many other Bedrock server images available on Github, you just need to look.
- My compose file will show that I have three minecraft servers running. Each represents a different world with different game playing settings.
IMPORTANT: If you run more than one Minecraft server you will need to make sure the port number for each instance is unique. Minecraft1 in my example is using the default Minecraft port (19132), while minecraft2 is using another available port. Also, if you use a port other than the default, a value for SERVER_PORT will need to be specified under the environment section. If SERVER_PORT is not assigned a port number, the instance will revert to the default. - The minecraft3 container is used to load different worlds exported from various iOS devices (it can be done with a little effort, instructions are below the compose content). LEVEL_NAME is used to specify the world to be loaded when a container starts. Unused worlds are commented out but can obviously be uncommented out and used with subsequent restarts.
version: '3'
services:
minecraft1:
container_name: minecraft-creative
image: itzg/minecraft-bedrock-server
restart: always
ports:
- 19132:19132/udp
volumes:
- /share/CACHEDEV1_DATA/Docker/minecraft-creative:/data
environment:
EULA: "TRUE"
GAMEMODE: "creative"
SERVER_NAME: "Hulks & Llamas Oh My"
TZ: America/Los_Angeles
stdin_open: true
tty: true
minecraft2:
container_name: minecraft-survival
image: itzg/minecraft-bedrock-server
restart: always
ports:
- 19130:19130/udp
volumes:
- /share/CACHEDEV1_DATA/Docker/minecraft-survival:/data
environment:
EULA: "TRUE"
GAMEMODE: "survival"
SERVER_NAME: "Survival Challenge"
SERVER_PORT: 19130
#DIFFICULTY: "normal"
TZ: America/Los_Angeles
stdin_open: true
tty: true
minecraft3:
container_name: minecraft-miscworlds
image: itzg/minecraft-bedrock-server
restart: always
ports:
- 19125:19125/udp
volumes:
- /share/CACHEDEV1_DATA/Docker/minecraft-miscworlds:/data
environment:
EULA: "TRUE"
GAMEMODE: "creative"
LEVEL_NAME: "Blowup World"
#LEVEL_NAME: "Bamboo Forest"
#LEVEL_NAME: "llama land"
#LEVEL_NAME: "Boiii"
#LEVEL_NAME: "My World1"
SERVER_NAME: "Saved World - Blow-up World"
SERVER_PORT: 19125
TZ: America/Los_Angeles
stdin_open: true
tty: true
Exporting Worlds from an iOS Device
- Open the Files app on your iOS device, browse to “On My iPad” (…or the equivalent for your iPhone), choose Minecraft, then open the “minecraftWorlds” folder found in the games/com.mojang path.
- The folders here will appear randomly named like E320XICIMgA= but each folder represents a distinct named world that was created in the the Minecraft app.
- Copy the desired folder(s) to iCloud. NOTE: this is the easiest method I found (relative to the apps on my devices) to transfer files off a device. You may find success by other means.
- Access iCloud from any workstation and download the files locally.
- Transfer each downloaded folder to the the Worlds folder in the persistant storage location of the relevant container.
- Rename the transferred folder(s) to something more readable. This name will be the value used for LEVEL_NAME in Docker Compose.