Skip to content

[BUG] Faulty service is attached despite its value #13113

@DanielJuravski

Description

@DanielJuravski

Description

Starting docker compose version v2.39.0, the service attach key seems to be misfunctional. In case of a service that fails (with restart: on-failure) with attach: false value, the docker compose command is "stuck" - due to that faulty service, despite the attach value being false. The expected behaviour (that was until v2.39.0) is that the docker compose command will not wait for a service to (successfully) complete. I suspect the reason for that buggy behavior is #13010 which was introduced in v2.39.0

Steps To Reproduce

  1. Install docker with docker compose plugin v2.39.0
  2. create the below dummy docker-compose.yaml:
services:
  svc-1:
    image: ubuntu
    restart: on-failure
    entrypoint: "hostname"
  svc-2:
    image: ubuntu
    restart: on-failure
    command: ["ls", "/nil"]
    attach: false
  1. run docker compose up
  2. Expected: the above command will complete successfully (as the svc-2 is with attach:false) (as happens up to COMPOSE_VERSION=v2.38.2)
  3. Actual: the above command is stuck as svc-2 fails

Compose Version

Docker Compose version v2.39.0

Docker Environment

Client: Docker Engine - Community
 Version:    28.3.3
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.26.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.39.0
    Path:     /home/ubuntu/.docker/cli-plugins/docker-compose
  model: Docker Model Runner (EXPERIMENTAL) (Docker Inc.)
    Version:  v0.1.36
    Path:     /usr/libexec/docker/cli-plugins/docker-model

Server:
 Containers: 8
  Running: 3
  Paused: 0
  Stopped: 5
 Images: 4
 Server Version: 28.3.3
 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: runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
 runc version: v1.2.5-0-g59923ef
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-1029-aws
 Operating System: Ubuntu 24.04.2 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 1.918GiB
 Name: ip-172-22-39-244
 ID: 5617af93-5dc8-4a49-a397-2d078ca4dca5
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Default Address Pools:
   Base: 10.80.0.0/16, Size: 24
   Base: 10.90.0.0/16, Size: 24

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions