Skip to content

[BUG] Service restarts, even if dependency did not restart successfully #12098

Open

Description

Description

Hi,

I have the following compose.yaml:

name: test

services:
  job:
    image: busybox:latest
    command: echo Hello World
    depends_on:
      job2:
        condition: service_completed_successfully

  job2:
    image: busybox:latest
    command: /bin/sh -c 'invalidcommand' # trigger error code

If I run docker compose up job2 does not complete successfully and job is not started (all good). Though if I run docker compose restart job gets started, even if job2 does not complete successfully.

The same behavior can be observed, if restart: true is set and docker compose restart job2 is called.

Steps To Reproduce

  1. Use compose.yaml shown above
  2. run docker compose up, job should not get started
  3. run docker compose restart, now job gets started, even if job2 does not complete successfully

Compose Version

Docker Compose version 2.29.2

Docker Environment

Client:
 Version:    27.2.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  0.16.2
    Path:     /usr/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  2.29.2
    Path:     /usr/lib/docker/cli-plugins/docker-compose
  scan: Docker Scan (Docker Inc.)
    Version:  v0.1.0-280-gc7fa31d4c4
    Path:     /usr/lib/docker/cli-plugins/docker-scan

Server:
 Containers: 38
  Running: 14
  Paused: 0
  Stopped: 24
 Images: 192
 Server Version: 27.1.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: true
  Native Overlay Diff: false
  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
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8fc6bcff51318944179630522a095cc9dbf9f353.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.10.6-arch1-1
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 30.74GiB
 Name: Pulse15-01
 ID: 10d8688d-7351-44fd-8668-39ea0eae5fe5
 Docker Root Dir: /home/vg-docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions