mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
parent
123292b56b
commit
5b8668d73f
@ -16,9 +16,13 @@ RUN echo "http://dl-3.alpinelinux.org/alpine/v3.5/community/" >> /etc/apk/reposi
|
||||
git \
|
||||
jq \
|
||||
mysql-client \
|
||||
python python-dev && \
|
||||
python python-dev py2-pip && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
RUN pip install mcstatus
|
||||
|
||||
HEALTHCHECK CMD mcstatus localhost ping
|
||||
|
||||
RUN addgroup -g 1000 minecraft \
|
||||
&& adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \
|
||||
&& mkdir /data \
|
||||
|
@ -117,6 +117,34 @@ or a specific version:
|
||||
|
||||
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
|
||||
|
||||
Enable Forge server mode by adding a `-e TYPE=FORGE` to your command-line.
|
||||
|
Loading…
Reference in New Issue
Block a user