Add a healthcheck to the Docker container image#10413
Merged
findepi merged 2 commits intotrinodb:masterfrom Feb 25, 2022
Merged
Add a healthcheck to the Docker container image#10413findepi merged 2 commits intotrinodb:masterfrom
findepi merged 2 commits intotrinodb:masterfrom
Conversation
electrum
approved these changes
Dec 29, 2021
Member
electrum
left a comment
There was a problem hiding this comment.
See comments, otherwise looks good. Thanks for adding this feature
7c277bb to
53b447f
Compare
53b447f to
bee811b
Compare
bee811b to
64a67be
Compare
findepi
reviewed
Feb 14, 2022
1c79d2f to
6e6ee42
Compare
2cdd937 to
eeb52dc
Compare
findepi
reviewed
Feb 24, 2022
eeb52dc to
ac15579
Compare
ac15579 to
3cb7ec9
Compare
findepi
approved these changes
Feb 24, 2022
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By defining a healthcheck command in the container image, users can quickly see if the container is ready to accept requests in the output of
docker ps:Without this, the
STATUScolumn only shows the uptime.It also frees uses from having to figure out the exact condition and they can use a generic loop that would wait for the container to be ready, like so:
If the healthcheck fails 3 times, it'll start showing as unhealthy. To see more details about the failure, one would have to run
docker inspect $CONTAINER_ID --format "{{json .State.Health}}", or run it one more time asdocker exec -it $CONTAINER_ID /usr/lib/trino/bin/health-check.This healthcheck is enabled by default and can be disabled by adding
--no-healthchecktodocker run.The same healthcheck script could be used in readiness and liveness probes in https://github.com/trinodb/charts