Skip to content

deploy replicas 0 fails with "no such service" in 2.3.0 and above #9356

Closed
@ghelyar

Description

@ghelyar

Description

When deploying a service that has 0 replicas with docker compose, it fails with "no such service: {name}"

We use docker compose with 0 replicas to deploy a service's dependencies without deploying the service itself.

This worked in docker compose 2.2.3, but started failing in 2.3.0 and still fails in 2.4.1.

Steps to reproduce the issue:

  1. Create the docker compose file:
version: "3"
services:
  a:
    image: redis:alpine
  b:
    image: redis:alpine
    deploy:
      replicas: 0
    depends_on:
      - a
  c:
    image: redis:alpine
  1. Run docker compose up -d b

Describe the results you received:
2.3.0:

$ docker compose up -d b
[+] Running 2/2
 ⠿ Network tmp_default  Created                                                                                                                                                                             0.1s
 ⠿ Container tmp-a-1    Created                                                                                                                                                                             0.1s
no such service: b

2.4.1:

$ docker compose up -d b
[+] Running 2/2
 ⠿ Network tmp_default  Created                                                                                                                                                                             0.1s
 ⠿ Container tmp-a-1    Created                                                                                                                                                                             0.1s
no such service: "b": not found

Describe the results you expected:

I expect a to be started, as a dependency of b, but not b itself, and not c, as it did in versions <= 2.2.3

2.2.3:

$ docker compose up -d b
[+] Running 2/2
 ⠿ Network tmp_default  Created                                                                                                                                                                             0.1s
 ⠿ Container tmp-a-1    Started  

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker compose version:

Docker Compose version v2.4.1

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.8.1-docker)
  compose: Docker Compose (Docker Inc., v2.4.1)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 1
 Server Version: 20.10.14
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3df54a852345ae127d1fa3092b95168e4a88e2f8
 runc version: v1.0.3-0-gf46b6ba
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.13.0-1021-azure
 Operating System: Ubuntu 20.04.4 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 7.767GiB
 Name: docker-test
 ID: CSQA:MWH2:7MTB:447M:T5UO:DWX5:35B7:JNYJ:3QFQ:PEU3:IM2S:LWMX
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional environment details:
Can reproduce on both Linux and Windows

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions