mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-17 07:03:57 +00:00
Compare commits
16 Commits
minecraft-
...
minecraft-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e845521a9 | ||
|
|
5557f91c79 | ||
|
|
c324403f95 | ||
|
|
9fe8d6cca6 | ||
|
|
55cffbb598 | ||
|
|
4ff077f151 | ||
|
|
5566cf0953 | ||
|
|
5d3845a9ba | ||
|
|
b952ee6fdd | ||
|
|
8035aa5f69 | ||
|
|
84521eca53 | ||
|
|
77541a9689 | ||
|
|
716ff66b1b | ||
|
|
029e7d8974 | ||
|
|
7d8429ef0a | ||
|
|
df155ee51c |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.idea/
|
||||
@@ -2,10 +2,12 @@ FROM ubuntu:trusty
|
||||
|
||||
MAINTAINER itzg
|
||||
|
||||
ENV APT_GET_UPDATE 2014-09-18
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get -y upgrade
|
||||
|
||||
RUN apt-get -y install ruby ruby-dev make patch
|
||||
RUN apt-get -y install ruby ruby-dev make patch nodejs
|
||||
RUN gem install bundler
|
||||
|
||||
ADD Gemfile /tmp/Gemfile
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
highlighter: pygments
|
||||
|
||||
1
minecraft-server/.gitignore
vendored
Normal file
1
minecraft-server/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/data/
|
||||
@@ -2,24 +2,26 @@ 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 apt-get install -y wget libmozjs-24-bin imagemagick && apt-get clean
|
||||
RUN update-alternatives --install /usr/bin/js js /usr/bin/js24 100
|
||||
|
||||
RUN wget -O /usr/bin/jsawk https://github.com/micha/jsawk/raw/master/jsawk
|
||||
RUN chmod +x /usr/bin/jsawk
|
||||
RUN useradd -M -s /bin/false minecraft \
|
||||
&& mkdir /data \
|
||||
&& chown minecraft:minecraft /data
|
||||
|
||||
EXPOSE 25565
|
||||
|
||||
ADD start.sh /start
|
||||
ADD start-minecraft.sh /start-minecraft
|
||||
|
||||
USER minecraft
|
||||
VOLUME ['/data']
|
||||
ADD server.properties /tmp/server.properties
|
||||
WORKDIR /data
|
||||
|
||||
CMD /start
|
||||
CMD [ "/start-minecraft" ]
|
||||
|
||||
ENV MOTD A Minecraft Server Powered by Docker
|
||||
ENV LEVEL world
|
||||
|
||||
@@ -1,37 +1,93 @@
|
||||
This docker image provides a Minecraft Server that will automatically download the latest stable, latest snapshot, or any specific server version.
|
||||
This docker image provides a Minecraft Server that will automatically download the latest stable,
|
||||
latest snapshot, or any specific version.
|
||||
|
||||
To simply use the latest stable version, run
|
||||
|
||||
docker run -d -p 25565:25565 itzg/minecraft-server
|
||||
|
||||
where the default server port, 25565, will be exposed on your host machine.
|
||||
where the default server port, 25565, will be exposed on your host machine. If you want to serve up multiple
|
||||
Minecraft servers or just use an alternate port, change the host-side port mapping such as
|
||||
|
||||
docker run -p 25566:25565 ...
|
||||
|
||||
will serve your Minecraft server on your host's port 25566 since the `-p` syntax is
|
||||
`host-port`:`container-port`.
|
||||
|
||||
Speaking of multiple servers, it's handy to give your containers explicit names using `--name`, such as
|
||||
|
||||
docker run -d -p 25565:25565 --name minecraft-default itzg/minecraft-server
|
||||
|
||||
With that you can easily view the logs, stop, or re-start the container:
|
||||
|
||||
docker logs -f minecraft-default
|
||||
( Ctrl-C to exit logs action )
|
||||
|
||||
docker stop minecraft-default
|
||||
|
||||
docker start minecraft-default
|
||||
|
||||
## EULA Support
|
||||
|
||||
Mojang now requires accepting the [Minecraft EULA](https://account.mojang.com/documents/minecraft_eula). To accept add
|
||||
|
||||
-e EULA=TRUE
|
||||
-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
|
||||
|
||||
docker run -e EULA=TRUE -d -p 25565:25565 itzg/minecraft-server
|
||||
|
||||
## Attaching data directory to host filesystem
|
||||
|
||||
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 directory on your host machine to the container's `/data` directory, such as:
|
||||
|
||||
docker run -d -v /path/on/host:/data ...
|
||||
|
||||
When attached in this way you can stop the server, edit the configuration under your attached `/path/on/host` and start the server again with `docker start CONTAINERID` to pick up the new configuration.
|
||||
|
||||
## Versions
|
||||
|
||||
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 itzg/minecraft-server
|
||||
|
||||
or a specific version:
|
||||
|
||||
docker run -d -e VERSION=1.7.9 -p 25565:25565 itzg/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 ...
|
||||
|
||||
or a specific version:
|
||||
|
||||
docker run -d -e VERSION=1.7.9 ...
|
||||
|
||||
## Server configuration
|
||||
|
||||
You can either switch between world saves or run multiple containers with different saves by using the `LEVEL` option,
|
||||
where the default is "world":
|
||||
|
||||
docker run -d -e LEVEL=bonus ...
|
||||
|
||||
**NOTE:** if running multiple containers be sure to either specify a different `-v` host directory for each
|
||||
`LEVEL` in use or don't use `-v` and the container's filesystem will keep things encapsulated.
|
||||
|
||||
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 itzg/minecraft-server
|
||||
|
||||
docker run -d -e 'MOTD=My Server' ...
|
||||
|
||||
If you leave it off, the last used or default message will be used. _The example shows how to specify a server
|
||||
message of the day that contains spaces by putting quotes around the whole thing._
|
||||
|
||||
To add more "op" (aka adminstrator) users to your Minecraft server, pass the Minecraft usernames separated by commas via the `OPS` environment variable, such as
|
||||
|
||||
docker run -d -e OPS=user1,user2 ...
|
||||
|
||||
A server icon can be configured using the `ICON` variable. The image will be automatically
|
||||
downloaded, scaled, and converted from any other image format:
|
||||
|
||||
docker run -d -e ICON=http://..../some/image.png
|
||||
|
||||
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):
|
||||
|
||||
docker run -e 'JVM_OPTS=-Xmx1024M -Xms1024M' ...
|
||||
|
||||
@@ -29,5 +29,5 @@ spawn-monsters=true
|
||||
generate-structures=true
|
||||
view-distance=10
|
||||
spawn-protection=16
|
||||
motd=A Minecraft Server
|
||||
motd=A Minecraft Server powered by Docker
|
||||
|
||||
|
||||
61
minecraft-server/start-minecraft.sh
Executable file
61
minecraft-server/start-minecraft.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/sh
|
||||
|
||||
case $VERSION in
|
||||
LATEST)
|
||||
export VERSION=`wget -O - https://s3.amazonaws.com/Minecraft.Download/versions/versions.json | jsawk -n 'out(this.latest.release)'`
|
||||
;;
|
||||
|
||||
SNAPSHOT)
|
||||
export VERSION=`wget -O - https://s3.amazonaws.com/Minecraft.Download/versions/versions.json | jsawk -n 'out(this.latest.snapshot)'`
|
||||
;;
|
||||
esac
|
||||
|
||||
cd /data
|
||||
|
||||
if [ ! -e minecraft_server.$VERSION.jar ]; then
|
||||
echo "Downloading minecraft_server.$VERSION.jar ..."
|
||||
wget -q https://s3.amazonaws.com/Minecraft.Download/versions/$VERSION/minecraft_server.$VERSION.jar
|
||||
fi
|
||||
|
||||
if [ ! -e server.properties ]; then
|
||||
cp /tmp/server.properties .
|
||||
fi
|
||||
|
||||
if [ -n "$MOTD" ]; then
|
||||
sed -i "/motd\s*=/ c motd=$MOTD" /data/server.properties
|
||||
fi
|
||||
if [ -n "$LEVEL" ]; then
|
||||
sed -i "/level-name\s*=/ c level-name=$LEVEL" /data/server.properties
|
||||
fi
|
||||
if [ -n "$OPS" ]; then
|
||||
echo $OPS | awk -v RS=, '{print}' >> ops.txt
|
||||
fi
|
||||
if [ -n "$ICON" ]; then
|
||||
echo "Using server icon from $ICON..."
|
||||
# Not sure what it is yet...call it "img"
|
||||
wget -q -O /tmp/icon.img $ICON
|
||||
specs=$(identify /tmp/icon.img | awk '{print $2,$3}')
|
||||
if [ "$specs" = "PNG 64x64" ]; then
|
||||
mv /tmp/icon.img /data/server-icon.png
|
||||
else
|
||||
echo "Converting image to 64x64 PNG..."
|
||||
convert /tmp/icon.img -resize 64x64! /data/server-icon.png
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -e /data/eula.txt ]; then
|
||||
if [ "$EULA" != "" ]; 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
|
||||
fi
|
||||
|
||||
java $JVM_OPTS -jar minecraft_server.$VERSION.jar
|
||||
@@ -1,39 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
case $VERSION in
|
||||
LATEST)
|
||||
export VERSION=`wget -O - https://s3.amazonaws.com/Minecraft.Download/versions/versions.json | jsawk -n 'out(this.latest.release)'`
|
||||
;;
|
||||
|
||||
SNAPSHOT)
|
||||
export VERSION=`wget -O - https://s3.amazonaws.com/Minecraft.Download/versions/versions.json | jsawk -n 'out(this.latest.snapshot)'`
|
||||
;;
|
||||
esac
|
||||
|
||||
cd /data
|
||||
|
||||
if [ ! -e minecraft_server.$VERSION.jar ]; then
|
||||
wget https://s3.amazonaws.com/Minecraft.Download/versions/$VERSION/minecraft_server.$VERSION.jar
|
||||
fi
|
||||
|
||||
if [ ! -e server.properties ]; then
|
||||
cp /tmp/server.properties .
|
||||
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
|
||||
set -e
|
||||
chown -R minecraft:minecraft /data
|
||||
exec su -s /bin/bash -c /start-minecraft minecraft
|
||||
|
||||
17
titan-gremlin/Dockerfile
Normal file
17
titan-gremlin/Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
||||
FROM itzg/ubuntu-openjdk-7
|
||||
|
||||
MAINTAINER itzg
|
||||
|
||||
RUN apt-get install -y wget unzip
|
||||
|
||||
RUN wget -q -O /tmp/titan.zip http://s3.thinkaurelius.com/downloads/titan/titan-0.5.0-hadoop2.zip
|
||||
RUN unzip /tmp/titan.zip -d /opt && rm /tmp/titan.zip
|
||||
|
||||
ENV TITAN_HOME /opt/titan-0.5.0-hadoop2
|
||||
WORKDIR $TITAN_HOME
|
||||
|
||||
VOLUME ["/conf","/data"]
|
||||
ADD start-gremlin.sh /opt/start-gremlin.sh
|
||||
|
||||
CMD ["/bin/bash", "-e", "/opt/start-gremlin.sh"]
|
||||
|
||||
14
titan-gremlin/README.md
Normal file
14
titan-gremlin/README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
Runs the Gremlin console from the Titan Graph Database "all" distribution.
|
||||
|
||||
To start the Gremlin console with the default configuration files available:
|
||||
|
||||
docker run -it itzg/titan-gremlin
|
||||
|
||||
In order to adjust or further define property files to use within Gremlin,
|
||||
attach a host directory to the container's `/conf` such as
|
||||
|
||||
docker run -it -v $(pwd)/conf:/conf itzg/titan-gremlin
|
||||
|
||||
After running once your host directory will be populated with the distribution-default
|
||||
configuration files. Modify those or add to them and they will available during
|
||||
the next use of gremlin.
|
||||
7
titan-gremlin/start-gremlin.sh
Executable file
7
titan-gremlin/start-gremlin.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $(ls /conf|wc -l) = 0 ]; then
|
||||
cp -r $TITAN_HOME/conf/* /conf
|
||||
fi
|
||||
|
||||
$TITAN_HOME/bin/gremlin.sh
|
||||
@@ -2,8 +2,7 @@ FROM ubuntu:trusty
|
||||
|
||||
MAINTAINER itzg
|
||||
|
||||
ENV APT_GET_UPDATE 2014-07-19
|
||||
|
||||
ENV APT_GET_UPDATE 2014-10-14
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y openjdk-7-jre-headless
|
||||
|
||||
|
||||
Reference in New Issue
Block a user