ProjectStack
docker

ERROR: No such service: X

Docker Compose couldn't find the service name you specified. This happens when you use docker-compose run, up, stop, or exec with a service name that doesn't match what's defined in your docker-compose.yml file.

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

  1. Check the exact service names defined in your docker-compose.yml: cat docker-compose.yml | grep ' [a-z]'
  2. List running Compose services: docker-compose ps
  3. Make sure you're running the command from the directory containing docker-compose.yml
  4. 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: webserver

Service 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.