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
- Check service names: docker compose config --services
- Pass every file: -f compose.yml -f compose.db.yml
- Enable the profile: --profile db
Detailed fix by platform
Docker Compose
docker compose -f compose.yml -f compose.override.yml config --services
How to diagnose
- Services — List from docker compose config
- Files — Which files are loaded?
- 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:
Similar errors
Most viewed in Docker
Other ways to find it
🧠 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026