{"record":{"id":"9235665e46a49af1","repo":"docker/compose","slug":"service-q-has-no-container-to-start","errorCode":null,"errorMessage":"service %q has no container to start","messagePattern":"service %q has no container to start","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compose/convergence.go","lineNumber":537,"sourceCode":"func (s *composeService) startService(ctx context.Context,\n\tproject *types.Project, service types.ServiceConfig,\n\tcontainers Containers, listener api.ContainerEventListener,\n\ttimeout time.Duration,\n) error {\n\tif service.Deploy != nil && service.Deploy.Replicas != nil && *service.Deploy.Replicas == 0 {\n\t\treturn nil\n\t}\n\n\terr := s.waitDependencies(ctx, project, service.Name, service.DependsOn, containers, timeout)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(containers) == 0 {\n\t\tif service.GetScale() == 0 {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"service %q has no container to start\", service.Name)\n\t}\n\n\tserviceContainers := containers.filter(isService(service.Name), isNotOneOff)\n\ttoStart := serviceContainers.filter(isNotRunning)\n\tif len(toStart) == 0 {\n\t\treturn nil\n\t}\n\n\t// pre_start runs once per service, only when no replica is already running\n\t// (e.g. initial up, force-recreate, or spec change). per_replica: false is\n\t// the only currently supported mode. Pick the replica with the lowest\n\t// container-number so the choice is deterministic regardless of the order\n\t// the daemon returns containers in.\n\tif len(service.PreStart) > 0 && len(serviceContainers) == len(toStart) {\n\t\tif err := s.runPreStart(ctx, project, service, lowestNumberedContainer(toStart), listener); err != nil {\n\t\t\treturn err\n\t\t}\n\t}","sourceCodeStart":519,"sourceCodeEnd":555,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/compose/convergence.go#L519-L555","documentation":"Error \"service %q has no container to start\" thrown in docker/compose.","triggerScenarios":"Compose attempted to start a service for which no container exists, typically because container creation was skipped or previously failed.","commonSituations":"Running 'docker compose start' on a service that was never created (no prior 'up'/'create'), or containers were removed out-of-band.","solutions":["Run docker compose up or docker compose create for the service first so a container exists to start.","Check for a scale=0 setting or profiles that prevent the container from being created."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}