mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-17 15:13:55 +00:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
205c57c3e3 | ||
|
|
1e0183a3b1 | ||
|
|
fd0500feb2 | ||
|
|
e86138cdf2 | ||
|
|
ddb69ced3b | ||
|
|
c48f85cc4f | ||
|
|
aa13deecdb | ||
|
|
4c0f24613c | ||
|
|
b5bcea7d61 | ||
|
|
76d4fd1bbc | ||
|
|
f7523eef4e | ||
|
|
c38bfb22cc | ||
|
|
8cea619c13 | ||
|
|
e570ac8715 | ||
|
|
d14d666e24 | ||
|
|
8956d43c47 | ||
|
|
911fcf8b42 | ||
|
|
3e61c8084f | ||
|
|
fe6e8c04ff | ||
|
|
f1293ff979 | ||
|
|
5c5b8cd999 | ||
|
|
074424a5bd | ||
|
|
99b1de0bbd |
@@ -2,7 +2,7 @@ FROM java:openjdk-8u72-jdk
|
||||
|
||||
MAINTAINER itzg
|
||||
|
||||
ENV CASSANDRA_VERSION 2.2.6
|
||||
ENV CASSANDRA_VERSION 2.2.7
|
||||
|
||||
RUN wget -qO /tmp/apache-cassandra.tgz http://mirrors.ibiblio.org/apache/cassandra/$CASSANDRA_VERSION/apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz
|
||||
RUN tar -C /opt -zxf /tmp/apache-cassandra.tgz && \
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
FROM java:8u92-jre-alpine
|
||||
FROM java:8u111-jre-alpine
|
||||
|
||||
MAINTAINER itzg
|
||||
|
||||
ENV ES_VERSION=2.3.4
|
||||
ENV ES_VERSION=2.4.3
|
||||
|
||||
ADD https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/$ES_VERSION/elasticsearch-$ES_VERSION.tar.gz /tmp/es.tgz
|
||||
RUN cd /usr/share && \
|
||||
tar xf /tmp/es.tgz && \
|
||||
rm /tmp/es.tgz
|
||||
|
||||
ADD start /start
|
||||
COPY start /start
|
||||
|
||||
EXPOSE 9200 9300
|
||||
|
||||
|
||||
@@ -49,7 +49,19 @@ and then check the cluster health, such as http://192.168.99.100:9200/_cluster/h
|
||||
"unassigned_shards" : 0
|
||||
}
|
||||
|
||||
# Configuration
|
||||
# Configuration Summary
|
||||
|
||||
## Ports
|
||||
|
||||
* `9200` - HTTP REST
|
||||
* `9300` - Native transport
|
||||
|
||||
## Volumes
|
||||
|
||||
* `/data` - location of `path.data`
|
||||
* `/conf` - location of `path.conf`
|
||||
|
||||
# Configuration Details
|
||||
|
||||
The following configuration options are specified using `docker run` environment variables (`-e`) like
|
||||
|
||||
@@ -169,3 +181,19 @@ The minimum, which can be calculated as `(master_eligible_nodes / 2) + 1`, can b
|
||||
Using the Docker Compose file above, a value of `2` is appropriate when scaling the cluster to 3 master nodes:
|
||||
|
||||
docker-compose scale master=3
|
||||
|
||||
## Auto transport/http discovery with Swarm Mode
|
||||
|
||||
When using Docker Swarm mode (starting with 1.12), the overlay and ingress network interfaces are assigned
|
||||
multiple IP addresses. As a result, it creates confusion for the transport publish logic even when using
|
||||
the special value `_eth0_`.
|
||||
|
||||
To resolve this, add
|
||||
|
||||
-e DISCOVER_TRANSPORT_IP=eth0
|
||||
|
||||
replacing `eth0` with another interface within the container, if needed.
|
||||
|
||||
The same can be done for publish/binding of the http module by adding:
|
||||
|
||||
-e DISCOVERY_HTTP_IP=eth2
|
||||
|
||||
@@ -18,6 +18,21 @@ OPTS="$OPTS -Des.path.conf=/conf \
|
||||
-Des.transport.tcp.port=9300 \
|
||||
-Des.http.port=9200"
|
||||
|
||||
discoverIpFromLink() {
|
||||
dev=$1
|
||||
mode=$2
|
||||
ip=`ipaddr show dev $dev scope global|awk '$1 == "inet" { if (!match($2,"/32")) { gsub("/.*","",$2) ; print $2 } }'`
|
||||
echo "Discovered $mode address $ip for $dev"
|
||||
OPTS="$OPTS -Des.$mode.host=$ip"
|
||||
}
|
||||
|
||||
if [ "$DISCOVER_TRANSPORT_IP" != "" ]; then
|
||||
discoverIpFromLink $DISCOVER_TRANSPORT_IP transport
|
||||
fi
|
||||
if [ "$DISCOVER_HTTP_IP" != "" ]; then
|
||||
discoverIpFromLink $DISCOVER_HTTP_IP http
|
||||
fi
|
||||
|
||||
if [ -n "$CLUSTER" ]; then
|
||||
OPTS="$OPTS -Des.cluster.name=$CLUSTER"
|
||||
if [ -n "$CLUSTER_FROM" ]; then
|
||||
|
||||
@@ -4,8 +4,9 @@ MAINTAINER itzg
|
||||
|
||||
ADD download-and-start.sh /download-and-start
|
||||
|
||||
ENV JENKINS_HOME /data
|
||||
VOLUME ["/data"]
|
||||
ENV JENKINS_HOME=/data
|
||||
|
||||
VOLUME ["/data", "/root", "/opt/jenkins"]
|
||||
EXPOSE 8080 38252
|
||||
|
||||
CMD ["/download-and-start"]
|
||||
|
||||
@@ -18,21 +18,6 @@ would be:
|
||||
|
||||
ID=$(docker run -d -p 8080:8080 -v /SOME_HOST_DIR:/data itzg/jenkins
|
||||
|
||||
# Entering the container to perform manual config
|
||||
|
||||
As with any Docker container, you can run a shell within the running container:
|
||||
|
||||
docker exec -it $ID bash
|
||||
|
||||
A more realistic example is installing git, openjdk-7-jdk, etc:
|
||||
|
||||
docker exec $ID apt-get update
|
||||
docker exec $ID apt-get install -y git openjdk-7-jdk
|
||||
|
||||
and then Configure the JDK in Jenkins:
|
||||
|
||||

|
||||
|
||||
# Enabling Jenkins slave agents
|
||||
|
||||
By default, Jenkins will pick a random port to allow slave nodes launched
|
||||
@@ -47,3 +32,20 @@ Launch your Jenkins container using
|
||||
and configure the port in the Global Security settings:
|
||||
|
||||

|
||||
|
||||
# Image Parameters
|
||||
|
||||
## Volumes
|
||||
|
||||
* `/data` - a majority of the Jenkins content is maintained here, such as workspaces
|
||||
* `/root` - some tools, such as Maven, utilize the home directory for default repository storage
|
||||
* `/opt/jenkins` - the installed distribution is expanded here
|
||||
|
||||
## Ports
|
||||
|
||||
* `8080` - for the web UI
|
||||
* `38252` - for slave incoming JMX access
|
||||
|
||||
## Environment Variables
|
||||
|
||||
* `JENKINS_OPTS` - passed to the initial Java invocation of Jenkins
|
||||
|
||||
@@ -26,4 +26,4 @@ fi
|
||||
|
||||
|
||||
cd /opt/jenkins
|
||||
exec java -jar jenkins.war
|
||||
exec java $JENKINS_OPTS -jar jenkins.war
|
||||
|
||||
@@ -14,12 +14,13 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
jq \
|
||||
&& apt-get clean
|
||||
|
||||
RUN useradd -M -s /bin/false --uid 1000 minecraft \
|
||||
RUN useradd -s /bin/false --uid 1000 minecraft \
|
||||
&& mkdir /data \
|
||||
&& mkdir /config \
|
||||
&& mkdir /mods \
|
||||
&& mkdir /plugins \
|
||||
&& chown minecraft:minecraft /data /config /mods /plugins
|
||||
&& mkdir /home/minecraft \
|
||||
&& chown minecraft:minecraft /data /config /mods /plugins /home/minecraft
|
||||
|
||||
EXPOSE 25565 25575
|
||||
|
||||
@@ -29,7 +30,7 @@ COPY start-minecraft.sh /start-minecraft
|
||||
COPY mcadmin.jq /usr/share
|
||||
RUN chmod +x /usr/local/bin/*
|
||||
|
||||
VOLUME ["/data","/mods","/config","/plugins"]
|
||||
VOLUME ["/data","/mods","/config","/plugins","/home/minecraft"]
|
||||
COPY server.properties /tmp/server.properties
|
||||
WORKDIR /data
|
||||
|
||||
@@ -39,4 +40,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 CONSOLE=true
|
||||
|
||||
@@ -161,13 +161,13 @@ Enable Bukkit/Spigot server mode by adding a `-e TYPE=BUKKIT -e VERSION=1.8` or
|
||||
|
||||
You can build spigot from source by adding `-e BUILD_FROM_SOURCE=true`
|
||||
|
||||
__NOTE: to avoid pegging the CPU when running Spigot,__ you will need to
|
||||
__NOTE: to avoid pegging the CPU when running Spigot,__ you will need to
|
||||
pass `--noconsole` at the very end of the command line and not use `-it`. For example,
|
||||
|
||||
docker run -d -v /path/on/host:/data \
|
||||
-e TYPE=SPIGOT -e VERSION=1.8 \
|
||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server --noconsole
|
||||
|
||||
|
||||
|
||||
You can install Bukkit plugins in two ways...
|
||||
|
||||
@@ -217,7 +217,7 @@ Enable PaperSpigot server mode by adding a `-e TYPE=PAPER -e VERSION=1.9.4` to y
|
||||
-e TYPE=PAPER -e VERSION=1.9.4 \
|
||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||
|
||||
__NOTE: to avoid pegging the CPU when running PaperSpigot,__ you will need to
|
||||
__NOTE: to avoid pegging the CPU when running PaperSpigot,__ you will need to
|
||||
pass `--noconsole` at the very end of the command line and not use `-it`. For example,
|
||||
|
||||
docker run -d -v /path/on/host:/data \
|
||||
@@ -277,7 +277,7 @@ minecraft-server:
|
||||
- "25565:25565"
|
||||
|
||||
environment:
|
||||
EULA: TRUE
|
||||
EULA: "TRUE"
|
||||
|
||||
image: itzg/minecraft-server
|
||||
|
||||
@@ -537,7 +537,13 @@ 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.
|
||||
|
||||
## JVM Configuration
|
||||
### 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 ...
|
||||
|
||||
## Miscellaneous Options
|
||||
|
||||
### Memory Limit
|
||||
|
||||
@@ -545,3 +551,7 @@ The Java memory limit can be adjusted using the `JVM_OPTS` environment variable,
|
||||
the setting shown in the example (max and min at 1024 MB):
|
||||
|
||||
docker run -e 'JVM_OPTS=-Xmx1024M -Xms1024M' ...
|
||||
|
||||
### /data ownership
|
||||
|
||||
In order to adapt to differences in `UID` and `GID` settings the entry script will attempt to correct ownership and writability of the `/data` directory. This logic can be disabled by setting `-e SKIP_OWNERSHIP_FIX=TRUE`.
|
||||
|
||||
@@ -3,7 +3,7 @@ minecraft-server:
|
||||
- "25565:25565"
|
||||
|
||||
environment:
|
||||
EULA: TRUE
|
||||
EULA: "TRUE"
|
||||
|
||||
image: itzg/minecraft-server
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -440,10 +441,16 @@ if [ "$TYPE" = "SPIGOT" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $CONSOLE = false ]]; then
|
||||
EXTRA_ARGS=--noconsole
|
||||
else
|
||||
EXTRA_ARGS=""
|
||||
fi
|
||||
|
||||
# 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 "$@" < /data/bootstrap.txt
|
||||
exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS < /data/bootstrap.txt
|
||||
else
|
||||
exec java $JVM_OPTS -jar $SERVER "$@"
|
||||
exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS
|
||||
fi
|
||||
|
||||
@@ -4,16 +4,19 @@ set -e
|
||||
usermod --uid $UID minecraft
|
||||
groupmod --gid $GID minecraft
|
||||
|
||||
chown -R minecraft:minecraft /data /start-minecraft
|
||||
chmod -R g+wX /data /start-minecraft
|
||||
if [ "$SKIP_OWNERSHIP_FIX" != "TRUE" ]; then
|
||||
fix_ownership() {
|
||||
dir=$1
|
||||
if ! sudo -u minecraft test -w $dir; then
|
||||
echo "Correcting writability of $dir ..."
|
||||
chown -R minecraft:minecraft $dir
|
||||
chmod -R u+w $dir
|
||||
fi
|
||||
}
|
||||
|
||||
while lsof -- /start-minecraft; do
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
mkdir -p /home/minecraft
|
||||
chown minecraft: /home/minecraft
|
||||
fix_ownership /data
|
||||
fix_ownership /home/minecraft
|
||||
fi
|
||||
|
||||
echo "Switching to user 'minecraft'"
|
||||
exec sudo -E -u minecraft /start-minecraft "$@"
|
||||
|
||||
Reference in New Issue
Block a user