-
Notifications
You must be signed in to change notification settings - Fork 74
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 with docker #19
Comments
I did some investigation and compared it to how it is done for the Oracle Database images in the oracle/docker-images repo and the only difference I could see is how the I tried the following:
and with this it works correctly. e.g.
I cannot explain why adding |
Thanks @filiphr, I'll have to take a look at that. I remember something about Since I'm building these images via I'll add |
It could be the way the image was build indeed. Anyways I realized what the problem was, I was forgetting the I managed to get GitHub actions understand the command by using the following options.
Perhaps this could be added to the docs as an option for the health command? I am still investigating why GitHub Actions ends up in an unhealthy state after 3 or 4 minutes of starting it (it never reaches the healthy state). |
Awesome, thanks a lot, @filiphr! Yeah absolutely, GitHub Action is an outstanding action item for me altogether. I think it's worthwhile writing up how to use these images with GitHub action altogether. Will definitely make sure I'll document this part here as well! Meanwhile, I'm trying to reproduce the issue with the health check. I think to remember that when I did add |
Well I only got it working that it will recognize the health command. However, the service doesn't really start. I've tried some things out in https://github.com/filiphr/oracle-docker-test. Thanks for documenting it |
Hm, they all die 32 seconds in saying that the initialization didn't work. Looks like still some sort of a timeout but I'm not very versed with GH Actions, so need to read myself into this. Thanks a lot for flagging this and for the tests you shared. I'll keep you posted and please do the same if you find anything. |
It is more than once. GitHub checks it several times with different backoff policy. There are at least 5 checks with 32 seconds apart. The container doesn't report that it is up and running. Locally with the same command it works great. Perhaps we need to reach out to someone at GitHub to help us out |
Oh, so it's the accumulation of e.g. 5 x 32 sec. That now makes sense why the overall run is 4mins+ in total. I'm just about reading myself into the doc of GitHub Actions. But it will take a while... |
It actually does 12 checks.
Is it possible due to the way the container is build? When I inspect the image with wagoodman/dive I can only see two layers. In case you want to try out different builds you could try and use the support for private registries. |
I think I got it. Try this instead:
Seems to work fine: Action definition: https://github.com/gvenzl/github-actions-tests/blob/main/.github/workflows/learn-github-actions.yml Job: https://github.com/gvenzl/github-actions-tests/runs/2597012866?check_suite_focus=true |
This is embarrassing 🤦 . I tried so many things, didn't try I think that this was the last step and now I would be able to migrate our GitHub actions to use your image. Thanks a lot for all the help |
Don't be, I googled around and found many variations of that option and no easy way to tell which one actually works! :D Certainly looks like the In any case, give that a go and see whether it works, please. Meanwhile, I will start documenting the GitHub Actions steps once I did some more tests and combinations. |
I just checked and I think that the problem is is in the evaluation in the environment variable. No idea how that is being resolved, since GitHub actions also resolves variables. Anyways, your last example (just using |
Ha, interesting, at least that explains why I found references with and without Great, that's good to hear! I will keep this issue open as a reminder for myself to document the GitHub Action part. One last question looking at your other database variants: do you know whether health-check then in general does not work without providing a health-check command? Or have just all database images moved on to no longer build Docker images but OCI |
That's a good question. I didn't realise this earlier. Not sure if the other DBs have a HEALTCHECK in their definitions. Seems like we didn't need to define the health check only for our Oracle Docker image that we build using this docker file (the official one from Oracle) using docker. I've found the issues for some of the other DBs and why they have not added HEALTCHECK or they have an open feature request only
I raised this issue because it worked for us with our previous Oracle image. However, after having read all of this and our previous discussion, only documenting it would be more than enough for me. I remember that it took me a while to figure our the health checks I need to do for every single DB last time. Your GitHub Action repo as an example is also great |
Thanks a lot for that research, @filiphr! I actually always found the While I understand the arguments that they bring up in these issues, and the general standpoint from Docker, I don't fully agree with them. But I don't think there is much that can be done. As they say, Kubernetes has its own interpretation of the readiness of a container, and Podman currently does not support it at all, and I sense that the future lies more in Podman than Docker. So even if it's fixed for Docker, it will be an issue for other environments and hence not reliable. In any case, the healthcheck.sh script stays within the images here, just like Postgres has its I will document the usage of the healthcheck with GitHub Actions directly in the ReadMe or an FAQ, which should hopefully help future users and give them exactly what they need. Once again, thanks so much for your patience and efforts here, I really appreciate it! |
It was my pleasure @gvenzl, glad I could help in any way possible. I really appreciate the work you are doing, it has made our life testing Oracle DB way easier. |
For some reason the health check is not being picked up correctly by docker.
When I do
Then I get
null
back. In addition to that when I dodocker container ls
then the status is not displayed for the running container.e.g.
When it works correctly the status is in branches after the time (e.g. "Up About a minute (healthy)")
GitHub Actions calls
docker inspect --format="{{if .Config.Healthcheck}}{{print .State.Health.Status}}{{end}}" <container>
to check the status of the container.I tried playing by passing a custom
--health-cmd
for the GitHub actions to work, but unfortunately I still couldn't make it work. GitHub only provides the status and nothing more so I can't even check the health logs to see what is happening in the container.The text was updated successfully, but these errors were encountered: