I’m using the following compose file:
sqlcl: image: myClientImage networks: - frontend depends_on: db: condition: service_healthy db: image: wnameless/oracle-xe-11g environment: - ORACLE_SID='' networks: - frontend healthcheck: test: ["CMD", "if [ ! -z $ORACLE_SID ]", "then echo 'done!' && exit 0", "else echo 'not yet' && exit 1", "fi"] interval: 30s timeout: 1s retries: 1 networks: frontend:
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.