From c15149cde321fb6e88fa3a5e49e2e17eb1aead23 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sat, 10 Mar 2018 15:42:35 +0100 Subject: [PATCH 1/2] adding healthcheck in Dockerfile --- Dockerfile | 2 ++ rootfs/usr/local/bin/healthcheck.sh | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100755 rootfs/usr/local/bin/healthcheck.sh diff --git a/Dockerfile b/Dockerfile index 95240b7f..5ff563da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,6 +29,8 @@ RUN apt-get update && \ # remove apt cache from image apt-get clean all +# Docker Healthcheck: +HEALTHCHECK CMD /usr/local/bin/healthcheck.sh # expose minecraft port EXPOSE 25565 diff --git a/rootfs/usr/local/bin/healthcheck.sh b/rootfs/usr/local/bin/healthcheck.sh new file mode 100755 index 00000000..59fa753c --- /dev/null +++ b/rootfs/usr/local/bin/healthcheck.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Basic healthcheck for docker, remove # from echo if you want some sort of output +# during build, it will show as unhealthy in docker ps + +if /usr/bin/supervisorctl status spigot | grep -q 'RUNNING'; then + # echo "matched" + exit 0 +else + # echo "failed" + exit 1 +fi From 6b2cedddd864c6beed1c75145a0db7e60a859bff Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sat, 10 Mar 2018 15:50:16 +0100 Subject: [PATCH 2/2] adding healthcheck in Dockerfile --- rootfs/usr/local/bin/healthcheck.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rootfs/usr/local/bin/healthcheck.sh b/rootfs/usr/local/bin/healthcheck.sh index 59fa753c..9ba065b9 100755 --- a/rootfs/usr/local/bin/healthcheck.sh +++ b/rootfs/usr/local/bin/healthcheck.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Basic healthcheck for docker, remove # from echo if you want some sort of output -# during build, it will show as unhealthy in docker ps +# Basic healthcheck for docker, remove # from echo if you want some sort of output. +# During build, it will show as unhealthy in docker ps if /usr/bin/supervisorctl status spigot | grep -q 'RUNNING'; then # echo "matched"