From c91a3ecd41230e12ea5ac1eb967496ff680470d8 Mon Sep 17 00:00:00 2001 From: Martijn Suijlen <37180297+BlueIcarus@users.noreply.github.com> Date: Mon, 30 Mar 2020 05:40:39 +0200 Subject: [PATCH] docker: Add a healthcheck (#152) Use the INBUCKET_WEB_ADDR value to get the port number of Inbucket using 'cut'. If the variable is not set, use the default value (and that is 0.0.0.0:9000). Healtcheck will check the exit code of the command executed (0=HEALTHY) --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index dc5ef6e..e15adea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,6 +44,9 @@ ENV INBUCKET_STORAGE_PARAMS path:/storage ENV INBUCKET_STORAGE_RETENTIONPERIOD 72h ENV INBUCKET_STORAGE_MAILBOXMSGCAP 300 +# Healthcheck +HEALTHCHECK --interval=5s --timeout=5s --retries=3 CMD /bin/sh -c 'wget localhost:$(echo ${INBUCKET_WEB_ADDR:-0.0.0.0:9000}|cut -d: -f2) -q -O - > /dev/null 2>&1' + # Ports: SMTP, HTTP, POP3 EXPOSE 2500 9000 1100