The stack came up but the API never did. docker ps shows db running but (unhealthy), and api isn't running at all — compose was told to wait for db to be healthy before starting api, and that never happened.
Yet the database looks fine in its logs. Figure out whether postgres is actually broken or whether something else is keeping the stack down, then get api up.
db — postgres:15, Up 20 minutes (unhealthy), on 5432.api — myapp:latest, Created (never started; gated on db health).$ docker ps -a
CONTAINER ID IMAGE STATUS NAMES
a0b1c2d3e4f5 postgres:15 Up 20 minutes (unhealthy) db
f5e4d3c2b1a0 myapp:latest Created api
$ docker inspect -f '{{json .State.Health}}' db
{"Status":"unhealthy","FailingStreak":4,"Log":[{"ExitCode":1,"Output":"",...}]}
You've solved it when:
, while .State.Health` shows the probe failing
(ExitCode: 1). The DB is up; the healthcheck command is wrong, so the
health gate falsely held api back.
api running (the dependency is genuinely available, sodocker CLI only..State.Health.Log come from, and why can it say unhealthydocker logs shows the server is up?
pgisready -U "$POSTGRESUSER"false (or a check against the wrong port/db) a classic
way to get a permanently-unhealthy-but-fine container?
dependson: condition: servicehealthy, what is the