[mc] Use G1 GC by default and simplify max memory setting

For #126
This commit is contained in:
Geoff Bourne 2017-02-14 22:15:36 -06:00
parent 134eaedf23
commit f5dbbcc2c6
3 changed files with 12 additions and 6 deletions

View file

@ -38,6 +38,6 @@ ENTRYPOINT [ "/start" ]
ENV UID=1000 GID=1000 \
MOTD="A Minecraft Server Powered by Docker" \
JVM_OPTS="-Xmx1024M -Xms1024M" \
JVM_XX_OPTS="-XX:+UseG1GC" MAX_MEMORY="1G" \
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy \
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= ONLINE_MODE=TRUE CONSOLE=true

View file

@ -608,10 +608,11 @@ By default, server checks connecting players against Minecraft's account databas
### Memory Limit
The Java memory limit can be adjusted using the `JVM_OPTS` environment variable, where the default is
the setting shown in the example (max and min at 1024 MB):
By default the image declares a Java memory limit of 1 GB. That can be adjusted
higher (or lower) by setting the `MAX_MEMORY` environment variable. For example,
the following increases the memory limit to 8 GB:
docker run -e 'JVM_OPTS=-Xmx1024M -Xms1024M' ...
docker run -e MAX_MEMORY=8G ...
### /data ownership

View file

@ -490,6 +490,11 @@ else
EXTRA_ARGS=""
fi
if [[ ! -z $MAX_MEMORY ]]; then
# put prior JVM_OPTS at the end to give any memory settings there higher precedence
JVM_OPTS="-Xms${MAX_MEMORY} -Xmx${MAX_MEMORY} ${JVM_OPTS}"
fi
set -x
if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
echo "Running FTB server modpack start ..."
exec sh ${FTB_SERVER_START}
@ -497,8 +502,8 @@ else
# If we have a bootstrap.txt file... feed that in to the server stdin
if [ -f /data/bootstrap.txt ];
then
exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS < /data/bootstrap.txt
exec java $JVM_XX_OPTS $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS < /data/bootstrap.txt
else
exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS
exec java $JVM_XX_OPTS $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS
fi
fi