diff --git a/minecraft-server/Dockerfile b/minecraft-server/Dockerfile index f4b8cf5e..89727832 100644 --- a/minecraft-server/Dockerfile +++ b/minecraft-server/Dockerfile @@ -39,4 +39,4 @@ ENV UID=1000 GID=1000 \ MOTD="A Minecraft Server Powered by Docker" \ JVM_OPTS="-Xmx1024M -Xms1024M" \ TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy \ - LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= + LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= ONLINE_MODE=TRUE diff --git a/minecraft-server/README.md b/minecraft-server/README.md index 4df93e1b..9db5f0fb 100644 --- a/minecraft-server/README.md +++ b/minecraft-server/README.md @@ -537,6 +537,12 @@ To use this option pass the environment variable `MODPACK`, such as top level of the zip archive. Make sure the jars are compatible with the particular `TYPE` of server you are running. +### Online mode + +By default, server checks connecting players against Minecraft's account database. If you want to create an offline server or your server is not connected to the internet, you can disable the server to try connecting to minecraft.net to authenticate players with environment variable `ONLINE_MODE`, like this + + docker run -d -e ONLINE_MODE=FALSE ... + ## JVM Configuration ### Memory Limit diff --git a/minecraft-server/start-minecraft.sh b/minecraft-server/start-minecraft.sh index 13e451a2..afd0d0f1 100755 --- a/minecraft-server/start-minecraft.sh +++ b/minecraft-server/start-minecraft.sh @@ -316,6 +316,7 @@ if [ ! -e server.properties ]; then setServerProp "level-seed" "$SEED" setServerProp "pvp" "$PVP" setServerProp "generator-settings" "$GENERATOR_SETTINGS" + setServerProp "online-mode" "$ONLINE_MODE" if [ -n "$LEVEL_TYPE" ]; then # normalize to uppercase