Re-introduction of health checks with depends_on in docker compose is amazing. Seriously was tired of writing health checks into every downstream container, especially things like a database initialization container.
That said, it seems as soon as I enable a health check/depends on, all output from those containers is buffered until the health check succeeds. Worse - if the container fails to start for some reason, the output is swallowed altogether, and you have to poke around with docker logs
to get the output.
So if I have a docker compose file something like:
mysql:
image: mysql:8.0
...
healthcheck:
test: [ "CMD", "mysql", "-u", "username", "--password=password", "-e", "show databases;" ]
interval: 10s
timeout: 2s
retries: 8640
start_period: 20s
...
health-check-check:
image: centos:8
depends_on:
mysql:
condition: service_healthy
command: [ "-c", "echo \"mysql up\"" ]
entrypoint: "bash"
Is there a way to get the mysql and health-check-check container output to compose stdout
- a) before the health checks are complete (i.e. unbuffered)
- b) regardless of health check success/failure