dependency failed to start: container fix10-cs-q1-db-1 has no healthcheck configured — a service waits on db with condition: service_healthy, and db has no healthcheck:. Give db a healthcheck, or wait with service_started instead.

service_healthy needs a health status to wait for, and a container without a healthcheck has none. Add a healthcheck: block to the service you depend on; the dependent service then starts once it reports healthy.

The error

PS> docker compose -p fix10-cs-q1 up
...
Attaching to db-1, web-1
 Container fix10-cs-q1-db-1 Starting
 Container fix10-cs-q1-db-1 Started
 Container fix10-cs-q1-db-1 Waiting
 Container fix10-cs-q1-db-1 Error dependency db failed to start
 Container fix10-cs-q1-web-1 not started: condition "service_healthy" of service "db" not met
dependency failed to start: container fix10-cs-q1-db-1 has no healthcheck configured

The command exited with code 1. docker compose config --quiet on the same file exited with code 0, so the file itself is valid and the problem shows only at up. The file:

services:
  db:
    image: alpine
    command: ["sleep", "30"]
  web:
    image: alpine
    command: ["echo", "web started"]
    depends_on:
      db:
        condition: service_healthy

Why it happens

The condition tells Compose to start web after db is healthy. db runs sleep 30 on the plain alpine image and has no healthcheck: in the file, so it never gets a health status. Compose reported that, exited with code 1, and left web in the Created state while db kept running:

PS> docker compose -p fix10-cs-q1 ps -a
NAME                IMAGE     COMMAND                SERVICE   CREATED        STATUS                  PORTS
fix10-cs-q1-db-1    alpine    "sleep 30"             db        1 second ago   Up Less than a second
fix10-cs-q1-web-1   alpine    "echo 'web started'"   web       1 second ago   Created

The fix

services:
  db:
    image: alpine
    command: ["sleep", "30"]
    healthcheck:
      test: ["CMD", "true"]
      interval: 2s
      retries: 3
  web:
    image: alpine
    command: ["echo", "web started"]
    depends_on:
      db:
        condition: service_healthy
PS> docker compose -p fix10-cs-q1 ps -a
NAME                IMAGE     COMMAND                SERVICE   CREATED         STATUS                   PORTS
fix10-cs-q1-db-1    alpine    "sleep 30"             db        4 seconds ago   Up 3 seconds (healthy)
fix10-cs-q1-web-1   alpine    "echo 'web started'"   web       4 seconds ago   Up Less than a second
PS> docker compose -p fix10-cs-q1 logs web
web-1  | web started

With a healthcheck, db showed (healthy) in the status column when ps ran, four seconds after it was created, and web started after that, as its log line shows. The file set interval: 2s and retries: 3 for the check. The test here is true, which always passes; for a real database use a command that checks the service itself. If you only need db to be running, condition: service_started worked without any healthcheck: both containers started and web printed web started.

How it was reproduced

Two alpine services, db running sleep 30 with no healthcheck and web with depends_on: db: condition: service_healthy, started with docker compose up from Windows PowerShell 5.1; then the same file with a healthcheck on db (started with up -d), and a copy with service_started. Docker Compose v5.7.0, Docker Engine 29.9.3, Docker Desktop 4.99.0 on Windows (version 10.0.26300). The project name fix10-cs-q1 is this test's own; it was removed with docker compose down -v after each run.

Frequently asked

What does 'has no healthcheck configured' mean in docker compose?
A service uses depends_on with condition: service_healthy, and the service it waits on has no healthcheck. Compose stops and does not start the waiting service.
How do I fix dependency failed to start has no healthcheck configured?
Add a healthcheck: block to the service named in depends_on, or change the condition to service_started if running is enough. Both worked in this test.
Does docker compose config catch a missing healthcheck?
No. In this test docker compose config --quiet exited with code 0 on the file, and the error appeared only at docker compose up.

More decoded errors in the Fixes category. When the healthcheck exists but fails, see Docker Compose: dependency failed to start, container is unhealthy.