unbound-docker
unbound-docker copied to clipboard
Allow setting healthcheck domain with an environment variable
It should be easy to set the domain for the HEALTHCHECK without having to copy/repeat/redefine the entire health check command.
This PR:
- Adds an environment variable
HEALTHCHECK_DOMAIN
to the container with default valuecloudflare.com
- Replaces
cloudflare.com
in the health check command with"${HEALTHCHECK_DOMAIN}"
Therefore allowing the user to set which domain is queried for the health check.
Due to the directory structure, a diff is provided below for clarity:
diff -urN 1.16.2/Dockerfile 1.16.3/Dockerfile
--- 1.16.2/Dockerfile 2022-09-07 22:31:39.284900810 -0400
+++ 1.16.3/Dockerfile 2022-09-07 22:38:06.670352779 -0400
@@ -102,6 +102,8 @@
SUMMARY="${NAME} is a validating, recursive, and caching DNS resolver." \
DESCRIPTION="${NAME} is a validating, recursive, and caching DNS resolver."
+ENV HEALTHCHECK_DOMAIN=cloudflare.com
+
WORKDIR /tmp/src
COPY --from=unbound /opt /opt
@@ -144,6 +146,6 @@
EXPOSE 53/tcp
EXPOSE 53/udp
-HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 CMD drill @127.0.0.1 cloudflare.com || exit 1
+HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 CMD drill @127.0.0.1 "${HEALTHCHECK_DOMAIN}" || exit 1
CMD ["/unbound.sh"]
Retrieved with:
diff -urN 1.16.{2,3}