Skip to content

Add docker healthcheck #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 13, 2020
Merged

Conversation

chapa
Copy link
Contributor

@chapa chapa commented May 12, 2020

Hey there,

I had a problem recently: the container stopped working because of a nasty error pthread_create: Resource temporarily unavailable.
It stopped working but was always "healthy" from the docker point of view.

This PR adds a HEALTHCHECK in the Dockerfile so that docker can detect if the service is down and restart the container if needed.

I created a special endpoint /health for that, to avoid wasting resources by generating an image on /.

@chapa chapa mentioned this pull request May 12, 2020
@jperelli
Copy link
Owner

jperelli commented May 13, 2020

I think it would be better to set it to unless-stopped instead of always. if we use always, we will have a leftover runnning container when developing.

@chapa
Copy link
Contributor Author

chapa commented May 13, 2020

You're right, I thought always restarts the container if the user stops it (like the behavior of deployment's pods in k8s), but actually it restarts it only when the docker daemon restarts.
I'll change to unless-stopped which seems better

@jperelli jperelli merged commit a2a4a67 into jperelli:master May 13, 2020
@jperelli
Copy link
Owner

pretty cool, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants