From a0806bee086f2f90cd6a2eab50416c7cd5fa7306 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Tue, 6 Feb 2018 20:20:13 +0100 Subject: [PATCH] Add health check to docker container Signed-off-by: Knut Ahlers --- Dockerfile | 5 ++++- zones.yml | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 62974cf..807fd0d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ COPY --from=0 /go/bin/coredns /usr/local/bin/ ADD ./requirements.txt /src/requirements.txt RUN set -ex \ - && apk --no-cache add python3 \ + && apk --no-cache add python3 bind-tools \ && pip3 install -r /src/requirements.txt ADD . /src @@ -26,5 +26,8 @@ EXPOSE 53/udp 53 VOLUME ["/src/zones"] +HEALTHCHECK --interval=30s --timeout=5s \ + CMD dig +short @localhost health.server.test TXT || exit 1 + ENTRYPOINT ["/usr/local/bin/coredns"] CMD ["--"] diff --git a/zones.yml b/zones.yml index 5a7b96a..6bad0ac 100644 --- a/zones.yml +++ b/zones.yml @@ -354,4 +354,10 @@ zones: - name: "" alias: docker01.cloud.kserver.biz. + server.test: + entries: + - name: health + type: TXT + records: + - "OK" ...