mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
33 lines
1.6 KiB
Markdown
33 lines
1.6 KiB
Markdown
## Healthcheck
|
|
|
|
This image contains [mc-monitor](https://github.com/itzg/mc-monitor) and uses its `status` 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:
|
|
|
|
``` shell
|
|
> docker container inspect -f "{{.State.Health.Status}}" mc
|
|
healthy
|
|
```
|
|
|
|
There's actually a wrapper script called `mc-health` that takes care of calling `mc-monitor status` with the correct arguments. If needing to customize the health checks parameters, such as in a compose file, then use something like the following in the service declaration:
|
|
|
|
``` yaml
|
|
healthcheck:
|
|
test: mc-health
|
|
start_period: 1m
|
|
interval: 5s
|
|
retries: 20
|
|
```
|
|
|
|
Some orchestration systems, such as Portainer, don't allow for disabling the default `HEALTHCHECK` declared by this image. In those cases you can approximate the disabling of healthchecks by setting the environment variable `DISABLE_HEALTHCHECK` to `true`.
|
|
|
|
### Healthchecks for older versions
|
|
|
|
This container disables Healthchecks for Versions before b1.8 as those versions do not support any kind of server pinging.
|
|
For more information see [Server List Ping](https://wiki.vg/Server_List_Ping#Beta_1.8_to_1.3)
|