Skip to content
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

HEALTH CHECK not working #93

Open
mikaelparkefelt opened this issue Sep 17, 2024 · 5 comments
Open

HEALTH CHECK not working #93

mikaelparkefelt opened this issue Sep 17, 2024 · 5 comments

Comments

@mikaelparkefelt
Copy link

I would like you add the possibility to add a HEALTH CHECK when running this container with a compose file.

Would this be possible to do that? or tell me what the syntax is int he compose file to get a health check.

@jonasgeiler
Copy link

jonasgeiler commented Oct 26, 2024

It currently isn't possible since the whoami Docker image is based on "scratch", which is basically a completely empty operating system. So no curl included.

It think it would be pretty easy to add a flag which, when enabled, just does a health check. So you'd just run the /whoami -healthcheck command and it does the request.
I also described this in #81.

@mikaelparkefelt
Copy link
Author

mikaelparkefelt commented Oct 29, 2024

So in the compose file I add command: /whoami --healthcheck insted of the default one?

@jonasgeiler
Copy link

@mikaelparkefelt wrote: So in the compose file I add command: /whoami --healthcheck insted of the default one?

You WOULD but it's currently not implemented!

@mikaelparkefelt
Copy link
Author

mikaelparkefelt commented Oct 29, 2024

So what exactly should i do then to get healthcheck to work?

@jonasgeiler
Copy link

@mikaelparkefelt wrote: So what exactly should i do then to get healthcheck to work?

At the moment there is not much you can do, except modify the container yourself, and f.e. inject the curl binary into it with a bind mount. Maybe I'll work on a PR which implements a healthcheck feature, though.

Here's how you could do it: docker run --rm --name whoami -v /usr/bin/curl:/curl --health-cmd '/curl --fail http://localhost:80/health' traefik/whoami

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

No branches or pull requests

2 participants