mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-07-18 14:34:55 +00:00
@@ -16,9 +16,13 @@ RUN echo "http://dl-3.alpinelinux.org/alpine/v3.5/community/" >> /etc/apk/reposi
|
|||||||
git \
|
git \
|
||||||
jq \
|
jq \
|
||||||
mysql-client \
|
mysql-client \
|
||||||
python python-dev && \
|
python python-dev py2-pip && \
|
||||||
rm -rf /var/cache/apk/*
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
RUN pip install mcstatus
|
||||||
|
|
||||||
|
HEALTHCHECK CMD mcstatus localhost ping
|
||||||
|
|
||||||
RUN addgroup -g 1000 minecraft \
|
RUN addgroup -g 1000 minecraft \
|
||||||
&& adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \
|
&& adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \
|
||||||
&& mkdir /data \
|
&& mkdir /data \
|
||||||
|
|||||||
@@ -117,6 +117,34 @@ or a specific version:
|
|||||||
|
|
||||||
docker run -d -e VERSION=1.7.9 ...
|
docker run -d -e VERSION=1.7.9 ...
|
||||||
|
|
||||||
|
## Healthcheck
|
||||||
|
|
||||||
|
This image contains [Dinnerbone's mcstatus](https://github.com/Dinnerbone/mcstatus) and uses
|
||||||
|
its `ping` command to continually check on the container's. That can be observed
|
||||||
|
from the `STATUS` column of `docker ps`
|
||||||
|
|
||||||
|
```
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
b418af073764 mc "/start" 43 seconds ago Up 41 seconds (healthy) 0.0.0.0:25565->25565/tcp, 25575/tcp mc
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also query the container's health in a script friendly way:
|
||||||
|
|
||||||
|
```
|
||||||
|
> docker container inspect -f "{{.State.Health.Status}}" mc
|
||||||
|
healthy
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally, since `mcstatus` is on the `PATH` you can exec into the container
|
||||||
|
and use mcstatus directly and invoke any of its other commands:
|
||||||
|
|
||||||
|
```
|
||||||
|
> docker exec mc mcstatus localhost status
|
||||||
|
version: v1.12 (protocol 335)
|
||||||
|
description: "{u'text': u'A Minecraft Server Powered by Docker'}"
|
||||||
|
players: 0/20 No players online
|
||||||
|
```
|
||||||
|
|
||||||
## Running a Forge Server
|
## Running a Forge Server
|
||||||
|
|
||||||
Enable Forge server mode by adding a `-e TYPE=FORGE` to your command-line.
|
Enable Forge server mode by adding a `-e TYPE=FORGE` to your command-line.
|
||||||
|
|||||||
Reference in New Issue
Block a user