Keycloak service is not healthy after workflow starts

I added a Keycloak service in the CI workflow, however the service does not seem to be up when the job starts. All connection attempts fail. The service is supposed to run with a local h2 database

I have encountered such an issue with MariaDB, where a healthcheck solved the issue… I added a healthcheck that is already submitted in a PR to the official keycloak docker image:

      keycloak:
        image: jboss/keycloak:15.0.2
        ports:
          - 8080:8080
        volumes:
          - /config/keycloak/realm-export.json:/tmp/realm-export.json
        env:
          KEYCLOAK_USER: admin
          KEYCLOAK_PASSWORD: test
          KEYCLOAK_IMPORT: /tmp/realm-export.json
          DB_VENDOR: h2
        options: --health-cmd "curl --fail http://localhost:8080/auth/realms/master" --health-interval 30s --health-timeout 3s --health-retries 3

It does not seem to solve the issue. The configuration works fine in local docker-compose.