depends on undefined service 🐳 Docker

service "web" depends on undefined service "db": invalid compose project

A service lists depends_on (or links/networks) for a service name that isn’t defined in the Compose file(s) being used.

Seen on: Docker

Meaning

Typos, renamed services, services defined in an override file you didn’t pass with -f, or profiles that disable the dependency all cause it.

Common causes

  • Service name typo or rename
  • Dependency lives in another compose file not passed with -f
  • Dependency has a profile that isn’t active
  • Indentation puts the service under the wrong key

⚡ Quick fix

  1. Check service names: docker compose config --services
  2. Pass every file: -f compose.yml -f compose.db.yml
  3. Enable the profile: --profile db

Detailed fix by platform

Docker Compose

  1. docker compose -f compose.yml -f compose.override.yml config --services

How to diagnose

  1. Services — List from docker compose config
  2. Files — Which files are loaded?
  3. Profiles — Active profiles

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.