You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in order to have a healthcheck in docker compose we need a command that returns a 0 exit code.
we either need a mailpit sub-command or an http client (e.g. curl) binary available inside the container.
for example, this docker compose file, uses curl (but a better approach would be to implement something equivalent of this example, but as a mailpit sub-command, e.g., mailpit readyz):
# see https://github.com/compose-spec/compose-spec/blob/master/spec.md# see https://github.com/opencontainers/image-spec/blob/master/annotations.mdservices:
mailpit:
# see https://hub.docker.com/r/axllent/mailpit# see https://github.com/axllent/mailpit# see https://mailpit.axllent.org/docs/install/docker/image: axllent/mailpit:v1.13.3command:
- --smtp-auth-accept-any
- --smtp-auth-allow-insecureports:
# smtp.# http://localhost:1025
- 1025:1025# http.# http://localhost:8025
- 8025:8025healthcheck:
test: ["CMD", "curl", "--silent", "--fail-with-body", "--max-time", "5", "http://localhost:8025/readyz"]interval: 15stimeout: 5sretries: 2restart: on-failure
with this in place, we can use docker compose up --wait, to make it wait for all the containers/services within the docker compose environment to being healthy.
The text was updated successfully, but these errors were encountered:
Thanks for the input @rgl, I'll look into this. The easiest solution would be to add curl to the Docker image - but I do see the benefits of a subcommand with a limited set of arguments, more specifically the listening interface & port (both as a commandline option and existing ENV variables). This way the docker image would only need to run mailpit ready (or similar) and return the exit status.
This has been released in v1.15.1. I added a readyz subcommand which, in Docker, should auto-detect the port, webroot and HTTPS status of the running daemon. I also added this to the Dockerfile so you probably do not need to specify your own (unless you wish to use different defaults) 👍
in order to have a healthcheck in docker compose we need a command that returns a 0 exit code.
we either need a mailpit sub-command or an http client (e.g.
curl
) binary available inside the container.for example, this docker compose file, uses
curl
(but a better approach would be to implement something equivalent of this example, but as a mailpit sub-command, e.g.,mailpit readyz
):with this in place, we can use
docker compose up --wait
, to make it wait for all the containers/services within the docker compose environment to being healthy.The text was updated successfully, but these errors were encountered: