mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-03-10 16:51:23 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54d19715c7 | ||
|
|
bbe1533f91 | ||
|
|
97040f61ed | ||
|
|
55801ac11c | ||
|
|
07c32d8ee4 | ||
|
|
2e631bcbd9 | ||
|
|
c96c630fe5 | ||
|
|
f69e75cfc1 | ||
|
|
6157a693f1 | ||
|
|
854a158d3d | ||
|
|
18919ef33c | ||
|
|
2d8b3d7275 | ||
|
|
f48eedee78 | ||
|
|
08d459c373 |
@@ -4,7 +4,7 @@ MAINTAINER itzg
|
|||||||
|
|
||||||
RUN apk -U add bash
|
RUN apk -U add bash
|
||||||
|
|
||||||
ENV ES_VERSION=5.2.1
|
ENV ES_VERSION=5.3.0
|
||||||
|
|
||||||
ADD https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VERSION.tar.gz /tmp/es.tgz
|
ADD https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VERSION.tar.gz /tmp/es.tgz
|
||||||
RUN cd /usr/share && \
|
RUN cd /usr/share && \
|
||||||
|
|||||||
@@ -181,7 +181,8 @@ To simplify all that, this image provides a `TYPE` variable to let you amongst t
|
|||||||
* `MASTER` : master-eligible, but holds no data. It is good to have three or more of these in a
|
* `MASTER` : master-eligible, but holds no data. It is good to have three or more of these in a
|
||||||
large cluster
|
large cluster
|
||||||
* `DATA` (or `NON_MASTER`) : holds data and serves search/index requests. Scale these out for elastic-y goodness.
|
* `DATA` (or `NON_MASTER`) : holds data and serves search/index requests. Scale these out for elastic-y goodness.
|
||||||
* `GATEWAY` : only operates as a client node or a "smart router". These are the ones whose HTTP port 9200 will need to be exposed
|
* `GATEWAY` (or `COORDINATING`) : only operates as a client node or a "smart router". These are the ones whose HTTP port 9200 will need to be exposed
|
||||||
|
* `INGEST` : operates only as an ingest node and is not master or data eligble
|
||||||
|
|
||||||
A [Docker Compose](https://docs.docker.com/compose/overview/) file will serve as a good example of these three node types:
|
A [Docker Compose](https://docs.docker.com/compose/overview/) file will serve as a good example of these three node types:
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,13 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
TYPE: GATEWAY
|
TYPE: GATEWAY
|
||||||
UNICAST_HOSTS: master
|
UNICAST_HOSTS: master
|
||||||
|
ingest:
|
||||||
|
image: itzg/elasticsearch
|
||||||
|
ports:
|
||||||
|
- "9222:9200"
|
||||||
|
environment:
|
||||||
|
TYPE: INGEST
|
||||||
|
UNICAST_HOSTS: master
|
||||||
kibana:
|
kibana:
|
||||||
image: kibana
|
image: kibana
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
@@ -77,15 +77,19 @@ setup_personality() {
|
|||||||
if [ -n "$TYPE" ]; then
|
if [ -n "$TYPE" ]; then
|
||||||
case $TYPE in
|
case $TYPE in
|
||||||
MASTER)
|
MASTER)
|
||||||
OPTS="$OPTS -E node.master=true -E node.data=false"
|
OPTS="$OPTS -E node.master=true -E node.data=false -E node.ingest=false"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
GATEWAY)
|
GATEWAY|COORDINATING)
|
||||||
OPTS="$OPTS -E node.master=false -E node.data=false"
|
OPTS="$OPTS -E node.master=false -E node.data=false -E node.ingest=false"
|
||||||
|
;;
|
||||||
|
|
||||||
|
INGEST)
|
||||||
|
OPTS="$OPTS -E node.master=false -E node.data=false -E node.ingest=true"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
DATA|NON_MASTER)
|
DATA|NON_MASTER)
|
||||||
OPTS="$OPTS -E node.master=false -E node.data=true"
|
OPTS="$OPTS -E node.master=false -E node.data=true -E node.ingest=false"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -1,30 +1,32 @@
|
|||||||
FROM openjdk:8-jre
|
FROM alpine
|
||||||
|
|
||||||
|
|
||||||
MAINTAINER itzg
|
MAINTAINER itzg
|
||||||
|
|
||||||
ENV APT_GET_UPDATE 2016-04-23
|
RUN echo "http://dl-3.alpinelinux.org/alpine/v3.5/community/" >> /etc/apk/repositories &&\
|
||||||
RUN apt-get update
|
apk update && \
|
||||||
|
apk add \
|
||||||
|
openjdk8-jre-base \
|
||||||
|
openssl \
|
||||||
|
imagemagick \
|
||||||
|
lsof \
|
||||||
|
su-exec \
|
||||||
|
bash \
|
||||||
|
git \
|
||||||
|
jq &&\
|
||||||
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
RUN addgroup -g 1000 minecraft \
|
||||||
imagemagick \
|
&& adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \
|
||||||
lsof \
|
|
||||||
nano \
|
|
||||||
sudo \
|
|
||||||
vim \
|
|
||||||
jq \
|
|
||||||
&& apt-get clean
|
|
||||||
|
|
||||||
RUN useradd -s /bin/false --uid 1000 minecraft \
|
|
||||||
&& mkdir /data \
|
&& mkdir /data \
|
||||||
&& mkdir /config \
|
&& mkdir /config \
|
||||||
&& mkdir /mods \
|
&& mkdir /mods \
|
||||||
&& mkdir /plugins \
|
&& mkdir /plugins \
|
||||||
&& mkdir /home/minecraft \
|
|
||||||
&& chown minecraft:minecraft /data /config /mods /plugins /home/minecraft
|
&& chown minecraft:minecraft /data /config /mods /plugins /home/minecraft
|
||||||
|
|
||||||
EXPOSE 25565 25575
|
EXPOSE 25565 25575
|
||||||
|
|
||||||
ADD https://github.com/itzg/restify/releases/download/1.0.3/restify_linux_amd64 /usr/local/bin/restify
|
ADD https://github.com/itzg/restify/releases/download/1.0.4/restify_linux_amd64 /usr/local/bin/restify
|
||||||
COPY start.sh /start
|
COPY start.sh /start
|
||||||
COPY start-minecraft.sh /start-minecraft
|
COPY start-minecraft.sh /start-minecraft
|
||||||
COPY mcadmin.jq /usr/share
|
COPY mcadmin.jq /usr/share
|
||||||
@@ -38,6 +40,6 @@ ENTRYPOINT [ "/start" ]
|
|||||||
|
|
||||||
ENV UID=1000 GID=1000 \
|
ENV UID=1000 GID=1000 \
|
||||||
MOTD="A Minecraft Server Powered by Docker" \
|
MOTD="A Minecraft Server Powered by Docker" \
|
||||||
JVM_XX_OPTS="-XX:+UseG1GC" MAX_MEMORY="1G" \
|
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
||||||
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy \
|
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy \
|
||||||
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= ONLINE_MODE=TRUE CONSOLE=true
|
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= ONLINE_MODE=TRUE CONSOLE=true
|
||||||
|
|||||||
@@ -608,11 +608,16 @@ By default, server checks connecting players against Minecraft's account databas
|
|||||||
|
|
||||||
### Memory Limit
|
### Memory Limit
|
||||||
|
|
||||||
By default the image declares a Java memory limit of 1 GB. That can be adjusted
|
By default, the image declares a Java initial and maximum memory limit of 1 GB. There are several
|
||||||
higher (or lower) by setting the `MAX_MEMORY` environment variable. For example,
|
ways to adjust the memory settings:
|
||||||
the following increases the memory limit to 8 GB:
|
|
||||||
|
|
||||||
docker run -e MAX_MEMORY=8G ...
|
* `MEMORY`, "1G" by default, can be used to adjust both initial (`Xms`) and max (`Xmx`)
|
||||||
|
memory settings of the JVM
|
||||||
|
* `INIT_MEMORY`, independently sets the initial heap size
|
||||||
|
* `MAX_MEMORY`, independently sets the max heap size
|
||||||
|
|
||||||
|
The values of all three are passed directly to the JVM and support format/units as
|
||||||
|
`<size>[g|G|m|M|k|K]`.
|
||||||
|
|
||||||
### /data ownership
|
### /data ownership
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
version: '3'
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
minecraft-server:
|
minecraft:
|
||||||
ports:
|
ports:
|
||||||
- "25570:25565"
|
- "25565:25565"
|
||||||
volumes:
|
volumes:
|
||||||
- "mcbig:/data"
|
- "mcbig:/data"
|
||||||
environment:
|
environment:
|
||||||
@@ -16,6 +16,14 @@ services:
|
|||||||
CONSOLE: "false"
|
CONSOLE: "false"
|
||||||
image: itzg/minecraft-server
|
image: itzg/minecraft-server
|
||||||
restart: always
|
restart: always
|
||||||
|
rcon:
|
||||||
|
image: itzg/rcon
|
||||||
|
ports:
|
||||||
|
- "4326:4326"
|
||||||
|
- "4327:4327"
|
||||||
|
volumes:
|
||||||
|
- "rcon:/opt/rcon-web-admin/db"
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
mcbig:
|
mcbig:
|
||||||
|
rcon:
|
||||||
|
|||||||
@@ -23,16 +23,16 @@ VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
|
|||||||
echo "Checking version information."
|
echo "Checking version information."
|
||||||
case "X$VERSION" in
|
case "X$VERSION" in
|
||||||
X|XLATEST|Xlatest)
|
X|XLATEST|Xlatest)
|
||||||
VANILLA_VERSION=`curl -sSL $VERSIONS_JSON | jq -r '.latest.release'`
|
VANILLA_VERSION=`wget -O - -q $VERSIONS_JSON | jq -r '.latest.release'`
|
||||||
;;
|
;;
|
||||||
XSNAPSHOT|Xsnapshot)
|
XSNAPSHOT|Xsnapshot)
|
||||||
VANILLA_VERSION=`curl -sSL $VERSIONS_JSON | jq -r '.latest.snapshot'`
|
VANILLA_VERSION=`wget -O - -q $VERSIONS_JSON | jq -r '.latest.snapshot'`
|
||||||
;;
|
;;
|
||||||
X[1-9]*)
|
X[1-9]*)
|
||||||
VANILLA_VERSION=$VERSION
|
VANILLA_VERSION=$VERSION
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
VANILLA_VERSION=`curl -sSL $VERSIONS_JSON | jq -r '.latest.release'`
|
VANILLA_VERSION=`wget -O - -q $VERSIONS_JSON | jq -r '.latest.release'`
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ function installForge {
|
|||||||
echo "Checking Forge version information."
|
echo "Checking Forge version information."
|
||||||
case $FORGEVERSION in
|
case $FORGEVERSION in
|
||||||
RECOMMENDED)
|
RECOMMENDED)
|
||||||
curl -o /tmp/forge.json -sSL http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
|
wget -q -O /tmp/forge.json http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
|
||||||
FORGE_VERSION=$(cat /tmp/forge.json | jq -r ".promos[\"$norm-recommended\"]")
|
FORGE_VERSION=$(cat /tmp/forge.json | jq -r ".promos[\"$norm-recommended\"]")
|
||||||
if [ $FORGE_VERSION = null ]; then
|
if [ $FORGE_VERSION = null ]; then
|
||||||
FORGE_VERSION=$(cat /tmp/forge.json | jq -r ".promos[\"$norm-latest\"]")
|
FORGE_VERSION=$(cat /tmp/forge.json | jq -r ".promos[\"$norm-latest\"]")
|
||||||
@@ -138,7 +138,7 @@ function installForge {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# URL format changed for 1.7.10 from 10.13.2.1300
|
# URL format changed for 1.7.10 from 10.13.2.1300
|
||||||
sorted=$((echo $FORGE_VERSION; echo 10.13.2.1300) | sort -V | head -1)
|
sorted=$( (echo $FORGE_VERSION; echo 10.13.2.1300) | sort | head -1)
|
||||||
if [[ $norm == '1.7.10' && $sorted == '10.13.2.1300' ]]; then
|
if [[ $norm == '1.7.10' && $sorted == '10.13.2.1300' ]]; then
|
||||||
# if $FORGEVERSION >= 10.13.2.1300
|
# if $FORGEVERSION >= 10.13.2.1300
|
||||||
normForgeVersion="$norm-$FORGE_VERSION-$norm"
|
normForgeVersion="$norm-$FORGE_VERSION-$norm"
|
||||||
@@ -189,7 +189,7 @@ function installFTB {
|
|||||||
echo "Unpacking FTB server modpack ${srv_modpack} ..."
|
echo "Unpacking FTB server modpack ${srv_modpack} ..."
|
||||||
local ftb_dir=/data/FeedTheBeast
|
local ftb_dir=/data/FeedTheBeast
|
||||||
mkdir -p ${ftb_dir}
|
mkdir -p ${ftb_dir}
|
||||||
unzip -u -o ${srv_modpack} -d ${ftb_dir}
|
unzip -o ${srv_modpack} -d ${ftb_dir}
|
||||||
cp -f /data/eula.txt ${ftb_dir}/eula.txt
|
cp -f /data/eula.txt ${ftb_dir}/eula.txt
|
||||||
FTB_SERVER_START=${ftb_dir}/ServerStart.sh
|
FTB_SERVER_START=${ftb_dir}/ServerStart.sh
|
||||||
chmod a+x ${FTB_SERVER_START}
|
chmod a+x ${FTB_SERVER_START}
|
||||||
@@ -363,7 +363,7 @@ if [ ! -e server.properties ]; then
|
|||||||
|
|
||||||
if [ -n "$LEVEL_TYPE" ]; then
|
if [ -n "$LEVEL_TYPE" ]; then
|
||||||
# normalize to uppercase
|
# normalize to uppercase
|
||||||
LEVEL_TYPE=${LEVEL_TYPE^^}
|
LEVEL_TYPE=$( echo ${LEVEL_TYPE} | tr '[:lower:]' '[:upper:]' )
|
||||||
echo "Setting level type to $LEVEL_TYPE"
|
echo "Setting level type to $LEVEL_TYPE"
|
||||||
# check for valid values and only then set
|
# check for valid values and only then set
|
||||||
case $LEVEL_TYPE in
|
case $LEVEL_TYPE in
|
||||||
@@ -402,7 +402,8 @@ if [ ! -e server.properties ]; then
|
|||||||
|
|
||||||
if [ -n "$MODE" ]; then
|
if [ -n "$MODE" ]; then
|
||||||
echo "Setting mode"
|
echo "Setting mode"
|
||||||
case ${MODE,,?} in
|
MODE_LC=$( echo $MODE | tr '[:upper:]' '[:lower:]' )
|
||||||
|
case $MODE_LC in
|
||||||
0|1|2|3)
|
0|1|2|3)
|
||||||
;;
|
;;
|
||||||
su*)
|
su*)
|
||||||
@@ -490,10 +491,10 @@ else
|
|||||||
EXTRA_ARGS=""
|
EXTRA_ARGS=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z $MAX_MEMORY ]]; then
|
# put these prior JVM_OPTS at the end to give any memory settings there higher precedence
|
||||||
# put prior JVM_OPTS at the end to give any memory settings there higher precedence
|
echo "Setting initial memory to ${INIT_MEMORY:-${MEMORY}} and max to ${MAX_MEMORY:-${MEMORY}}"
|
||||||
JVM_OPTS="-Xms${MAX_MEMORY} -Xmx${MAX_MEMORY} ${JVM_OPTS}"
|
JVM_OPTS="-Xms${INIT_MEMORY:-${MEMORY}} -Xmx${MAX_MEMORY:-${MEMORY}} ${JVM_OPTS}"
|
||||||
fi
|
|
||||||
set -x
|
set -x
|
||||||
if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
|
if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
|
||||||
echo "Running FTB server modpack start ..."
|
echo "Running FTB server modpack start ..."
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
usermod --uid $UID minecraft
|
sed -i "/^minecraft/s/1000/${UID}/g" /etc/passwd
|
||||||
groupmod --gid $GID minecraft
|
sed -i "/^minecraft/s/1000/${GID}/g" /etc/group
|
||||||
|
|
||||||
if [ "$SKIP_OWNERSHIP_FIX" != "TRUE" ]; then
|
if [ "$SKIP_OWNERSHIP_FIX" != "TRUE" ]; then
|
||||||
fix_ownership() {
|
fix_ownership() {
|
||||||
dir=$1
|
dir=$1
|
||||||
if ! sudo -u minecraft test -w $dir; then
|
if ! su-exec minecraft test -w $dir; then
|
||||||
echo "Correcting writability of $dir ..."
|
echo "Correcting writability of $dir ..."
|
||||||
chown -R minecraft:minecraft $dir
|
chown -R minecraft:minecraft $dir
|
||||||
chmod -R u+w $dir
|
chmod -R u+w $dir
|
||||||
@@ -19,4 +19,4 @@ if [ "$SKIP_OWNERSHIP_FIX" != "TRUE" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Switching to user 'minecraft'"
|
echo "Switching to user 'minecraft'"
|
||||||
exec sudo -E -u minecraft /start-minecraft "$@"
|
su-exec minecraft /start-minecraft $@
|
||||||
|
|||||||
Reference in New Issue
Block a user