oci-oracle-xe: Health check not working with docker

For some reason the health check is not being picked up correctly by docker.

When I do

docker inspect --format "{{json .Config.Healthcheck }} <container>

Then I get null back. In addition to that when I do docker container ls then the status is not displayed for the running container.

e.g.

CONTAINER ID   IMAGE                      COMMAND                  CREATED              STATUS              PORTS                     NAMES
925ac8dbba4b   gvenzl/oracle-xe:11-slim   "container-entrypoin…"   About a minute ago   Up About a minute   0.0.0.0:49161->1521/tcp   exciting_wu

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.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

Don’t be, I googled around and found many variations of that option and no easy way to tell which one actually works! 😄

Certainly looks like the ="... is not the correct syntax but I also tried without the = and that didn’t work either, so I assumed that perhaps the environment variable wasn’t being resolved but not sure. 🤷🏻‍♂️

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.

It could be the way the image was build indeed. Anyways I realized what the problem was, I was forgetting the ORACLE_PASSWORD 🤦 . It doesn’t help that the logs in GitHub actions just say “unhealthy”.

I managed to get GitHub actions understand the command by using the following options.

--health-cmd="\${ORACLE_BASE}/healthcheck.sh >/dev/null || exit 1"
--health-interval 20s
--health-timeout 10s
--health-retries 10

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).