docker/compose · error

service %q has no container to start

Error message

service %q has no container to start

What it means

Error "service %q has no container to start" thrown in docker/compose.

Source

Thrown at pkg/compose/convergence.go:537

func (s *composeService) startService(ctx context.Context,
	project *types.Project, service types.ServiceConfig,
	containers Containers, listener api.ContainerEventListener,
	timeout time.Duration,
) error {
	if service.Deploy != nil && service.Deploy.Replicas != nil && *service.Deploy.Replicas == 0 {
		return nil
	}

	err := s.waitDependencies(ctx, project, service.Name, service.DependsOn, containers, timeout)
	if err != nil {
		return err
	}

	if len(containers) == 0 {
		if service.GetScale() == 0 {
			return nil
		}
		return fmt.Errorf("service %q has no container to start", service.Name)
	}

	serviceContainers := containers.filter(isService(service.Name), isNotOneOff)
	toStart := serviceContainers.filter(isNotRunning)
	if len(toStart) == 0 {
		return nil
	}

	// pre_start runs once per service, only when no replica is already running
	// (e.g. initial up, force-recreate, or spec change). per_replica: false is
	// the only currently supported mode. Pick the replica with the lowest
	// container-number so the choice is deterministic regardless of the order
	// the daemon returns containers in.
	if len(service.PreStart) > 0 && len(serviceContainers) == len(toStart) {
		if err := s.runPreStart(ctx, project, service, lowestNumberedContainer(toStart), listener); err != nil {
			return err
		}
	}

View on GitHub (pinned to ddc4b044b6)

Solutions

  1. Run docker compose up or docker compose create for the service first so a container exists to start.
  2. Check for a scale=0 setting or profiles that prevent the container from being created.

When it happens

Trigger: Compose attempted to start a service for which no container exists, typically because container creation was skipped or previously failed.

Common situations: Running 'docker compose start' on a service that was never created (no prior 'up'/'create'), or containers were removed out-of-band.


AI-assisted analysis of docker/compose@ddc4b044b6 (2026-08-15). Data as JSON: /api/errors/9235665e46a49af1. Report an issue: GitHub.