Buildkite docker-compose plugin "service not found" in CI
The docker-compose plugin runs the service named in its run key. If that name is missing from the referenced compose file, Docker Compose reports "no such service" and the step fails.
What this error means
A step using the docker-compose plugin fails with "no such service" naming the service the plugin tried to run.
$ docker compose -f docker-compose.yml run app
no such service: app
The command exited with status 1Common causes
The run service name does not match the compose file
The plugin run: app refers to a service that is spelled differently or absent in docker-compose.yml.
The wrong compose file is referenced
The plugin points at a compose file that does not define the service, for example an override file used alone.
How to fix it
Match the run service to a defined service
- Open the compose file and list the service keys under
services:. - Set the plugin
runvalue to one of those exact names. - Reference every compose file the service needs.
steps:
- command: "npm test"
plugins:
- docker-compose#v4.16.0:
run: app
config: docker-compose.ymlInclude all required compose files
If the service is split across files, pass them all so the service is defined when the plugin runs it.
plugins:
- docker-compose#v4.16.0:
run: app
config:
- docker-compose.yml
- docker-compose.ci.ymlHow to prevent it
- Keep the plugin
runname in sync with the compose service keys. - Reference every compose file needed to define the service.
- Validate the compose config with
docker compose configin review.