Added support for Minecraft server EULA and update default to 1.8

This commit is contained in:
Geoff Bourne 2014-09-07 23:18:20 +00:00
parent 84154c3d64
commit f85240898d
3 changed files with 44 additions and 21 deletions

View file

@ -2,6 +2,8 @@ FROM itzg/ubuntu-openjdk-7
MAINTAINER itzg
ENV APT_UPDATED 2014-09-07
RUN apt-get update
RUN apt-get install -y wget libmozjs-24-bin
RUN update-alternatives --install /usr/bin/js js /usr/bin/js24 100
@ -21,5 +23,5 @@ CMD /start
ENV MOTD A Minecraft Server Powered by Docker
ENV LEVEL world
ENV JVM_OPTS -Xmx512M -Xms512M
ENV VERSION 1.7.9
ENV JVM_OPTS -Xmx1024M -Xms1024M
ENV VERSION 1.8

View file

@ -2,28 +2,36 @@ This docker image provides a Minecraft Server that will automatically download t
To simply use the latest stable version, run
docker run -d -p 25565:25565 minecraft-server
docker run -d -p 25565:25565 itzg/minecraft-server
where the default server port, 25565, will be exposed on your host machine.
In order to persist the Minecraft data, which you *probably want to do for a real server setup*, use the `-v` argument to map a local path to the `/data' path in the container, such as
Mojang now requires accepting the [Minecraft EULA](https://account.mojang.com/documents/minecraft_eula). To accept add
docker run -d -v /path/on/host:/data -p 25565:25565 minecraft-server
-e EULA=TRUE
such as
docker run -e EULA=TRUE -d -p 25565:25565 itzg/minecraft-server
In order to persist the Minecraft data, which you *probably want to do for a real server setup*, use the `-v` argument to map a local path to the `/data' path in the container,
docker run -d -v /path/on/host:/data -p 25565:25565 itzg/minecraft-server
To use a different Minecraft version, pass the `VERSION` environment variable, which can have the value
* LATEST
* SNAPSHOT
* (or a specific version, such as "1.7.9")
For example, to use the latest snapshot:
docker run -d -e VERSION=SNAPSHOT -p 25565:25565 minecraft-server
or a specific version:
docker run -d -e VERSION=1.7.9 -p 25565:25565 minecraft-server
* LATEST
* SNAPSHOT
* (or a specific version, such as "1.7.9")
For example, to use the latest snapshot:
docker run -d -e VERSION=SNAPSHOT -p 25565:25565 itzg/minecraft-server
or a specific version:
docker run -d -e VERSION=1.7.9 -p 25565:25565 itzg/minecraft-server
The message of the day, shown below each server entry in the UI, can be changed with the `MOTD` environment variable, such as
docker run -d -e 'MOTD=My Server' -p 25565:25565 minecraft-server
docker run -d -e 'MOTD=My Server' -p 25565:25565 itzg/minecraft-server

View file

@ -23,4 +23,17 @@ fi
sed -i "/motd\s*=/ c motd=$MOTD" /data/server.properties
sed -i "/level-name\s*=/ c level-name=$LEVEL" /data/server.properties
if [ "$EULA" != "" -a ! -e /data/eula.txt ]; then
echo "# Generated via Docker on $(date)" > eula.txt
echo "eula=$EULA" >> eula.txt
else
echo ""
echo "Please accept the Minecraft EULA at"
echo " https://account.mojang.com/documents/minecraft_eula"
echo "by adding the following immediately after 'docker run':"
echo " -e EULA=TRUE"
echo ""
exit 1
fi
java $JVM_OPTS -jar minecraft_server.$VERSION.jar