The db container uses a script as ENTRYPOINT that actually starts the db server and then sets the environment variable ORACLE_SID. What I want to achieve is that my client waits for the server to be readily started. According to the docs, that’s what healtchcheck should do.
What actually happens is that starting the db container is blocked and the client fails with db is unhealthy. What am I doing wrong here?
When I remove the healthcheck related config both containers start, the client however before the server is ready.
I don’t think that this is just a timing issue. As I stated, to me it appears as if the container itself waits to become healthy before executing the ENTRYPOINT command. Which would be weird.
Eg I docker run the container from the image and see that it is up with 1 min or so. However, when I use compose up with the health check, it reports as unhealthy after 5 min using interval: 1m, timeout 1s, retries 5
did you try your healthcheck command? it currently doesn’t really help you anything. it checks an immutable environment which you just provided in a loop.
ORACLE_SID also never gets a different value, so better use another healthcheck.
So to mitigate the probably broken health check a restart policy could help. But you are right, it’s better to work on the health check.
Isn’t there a way to connect to the database and execute a very simple query? This would be an ideal health check.