Skip to content

[BUG] Services with zero replicas fail to start when they have a dependency that has zero replicas #13899

Description

@ewan-escience

Description

Since (I think) v5.3.0, services with 0 replicas generate an error when they depend on a dependency that also has 0 replicas. This used to work without any errors before

Steps To Reproduce

Create a docker-compose.yml with the following content:

services:
  independent:
    image: alpine:3.24.1

  dependency:
    image: alpine:3.24.1
    deploy:
      replicas: 0

  dependent_on:
    image: alpine:3.24.1
    deploy:
      replicas: 0
    depends_on:
      dependency:
        condition: service_healthy

Run docker compose up. You will see the message:

Attaching to independent-1
dependent_on is missing dependency dependency

In older versions, no error would be generated and service independent would start (and exit) successfully.

Compose Version

Docker Compose version v5.3.0

Docker Environment

Client: Docker Engine - Community
 Version:    29.6.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.35.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v5.3.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 11
  Running: 2
  Paused: 0
  Stopped: 9
 Images: 322
 Server Version: 29.6.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: e53c7c1516c3b2bff98eb76f1f4117477e6f4e66
 runc version: v1.3.6-0-g491b69ba
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns

The rest contains info about my computer so I'm leaving that out.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions