There are many Minecraft Docker images already developed, why develop another?
From what I was able to find, no Minecraft Docker image currently handles signals. That means when a docker stop command is issued, Docker will attempt to signal the process to gracefully quits, but the process ignores it. Docker then terminates the server without the Minecraft server saving the state, leaving the potential of corrupted data.
By writing a simple wrapper (wrapper.py), this image is able to process the SIGTERM signal that is sent by Docker during a docker stop command. That is then turned into an RCON call, which instructs the server to safely exit and close.
In order to keep simplicity, the container will be mounted to paths on the host disk. This will allow existing automation that manages things like ops.txt or server.properties to continue to work.
# Copy configuraitons into Minecraft directory (If you have automation in
# place, run that here; that shouldn't need to change).
mkdir -p /srv/minecraft/
cp ~/my_server.properties /srv/minecraft/server.properties
echo "eula=true" > /srv/minecraft/eula.txt"
# Start Minecraft Server
docker run \
-e MINECRAFT_VERISON=1.11.2 \
-v /srv/minecraft/:/minecraft/:rw \
--publish 25565:25565 \
mide/minecraft:latest
| Option | Expected Value | Location |
|---|---|---|
enable-rcon | true | server.properties |
rcon.password | Your RCON Password | server.properties |
rcon.port | Your RCON Port | server.properties |
eula | true | eula.txt |
MINECRAFT_VERSION | Something like 1.11.2 | Environment Variable |
| Option | Description | Default Value | Location |
|---|---|---|---|
JAVA_TOOL_OPTIONS | JVM Settings, like heap size | -Xmx1024M -Xms1024M | Environment Variable |
broadcast-rcon-to-ops | Announce RCON commands to Server Ops | false ??? TODO | server.properties |
Content type
Image
Digest
Size
194.9 MB
Last updated
over 5 years ago
docker pull mide/minecraft