docker/compose

[BUG] `depends_on` stripped for extended services

stormshield-fabs opened this issue · 3 comments

Description

When a service uses both extends and depends_on, the depends_on map is stripped in the rendered configuration.

Steps To Reproduce

Run docker compose config with the following file

services:
  service_a:
    image: alpine:latest
  
  service_b:
    extends: service_a
    depends_on:
      service_a:
        condition: service_completed_successfully

Docker 27.4.0 (compose 2.31.0):

name: docker
services:
  service_a:
    image: alpine:latest
    networks:
      default: null
  service_b:
    depends_on:
      service_a:
        condition: service_completed_successfully
        required: true
    image: alpine:latest
    networks:
      default: null
networks:
  default:
    name: docker_default

Docker 27.4.1 (compose 2.32.1):

name: docker
services:
  service_a:
    image: alpine:latest
    networks:
      default: null
  service_b:
    image: alpine:latest
    networks:
      default: null
networks:
  default:
    name: docker_default

(note the missing depends_on)

Compose Version

Docker Compose version v2.32.1

Docker Environment

Client: Docker Engine - Community
 Version:    27.4.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.19.3
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.32.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 16
 Server Version: 27.4.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
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 88bf19b2105c8b17560993bee28a01ddc2f97182
 runc version: v1.2.2-0-g7cb3632
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-49-generic
 Operating System: Ubuntu 22.04.5 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 31.01GiB
 Name: REDACTED
 ID: e6b3efa0-3763-471b-96a3-9166fee1ce35
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

This might be related to #12360 and compose-spec/compose-go#718

This is indeed related to this PR and is intentional, as described in the documentation: depends_on is excluded when a service is used as source by extends

@ndeloof i would argue that volumes_from and depends_on are never shared between services using extends in the example it is not "shared" from service_a to service_b and explicitly defined as depends_on in service_b and nonetheless stripped in the config from service_b. Are you refering to a different section of the documentation?

Note: this also breaks our project/doodba

hum indeed, that definitely a bug here