Common causes
- Typo in the service name — Compose service names are case-sensitive
- Running the command from a directory without a docker-compose.yml or with the wrong compose file
- The service was renamed in the compose file but the command wasn't updated
- Specifying a container name instead of a service name — these are different in Compose
How to fix it
- Check the exact service names defined in your docker-compose.yml: cat docker-compose.yml | grep ' [a-z]'
- List running Compose services: docker-compose ps
- Make sure you're running the command from the directory containing docker-compose.yml
- Specify an alternate file if needed: docker-compose -f path/to/docker-compose.yml up servicename
Example
$ docker-compose run webserver bash
ERROR: No such service: webserverService is defined as 'web' in docker-compose.yml but command used 'webserver'
Browse more errors
The Developer Hub covers 150+ errors across Git, npm, Node.js, Python, TypeScript, and Docker — with plain-English explanations and fix steps.
