feat: add health check command to the container #516
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.
Description
This PR adds a small improvement to the container, which utilises the Docker
HEALTHCHECK
command to report the inner state of the app to the Docker runtime. Basically, it runs thecurl
command periodically to check whether the webserver is up or not.Motivation: I left a typo in my
run.py
file that I didn't notice and restarted the host around an hour later. That small issue led to a restart loop, but my Portainer instance reportedRunning
- which in fact was true. I think if it would've had this health check, I could see the problem on the UI.Type of change
How Has This Been Tested?
I started a local container with the example
run.py
and when I inspected it, I could see the error logs:Running the same health check command in my "prod" container, returned exit code 0 which means everything is fine.
Checklist: