Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Docker compose v2.32 no longer respects depends_on: when using extends: from another file #12425

Closed
maxmarsakov opened this issue Dec 31, 2024 · 2 comments

Comments

@maxmarsakov
Copy link

Description

Hi,
docker-compose v2.32 introduces a regression compared to the previous version, in which the depends_on directive is omitted and is not used when using docker-compose commands (for example when starting the service, the related services won't start), while using extends directive from another file.
I've included the steps to reproduce below.
Would appreciate it if you could take a look.
Thanks!

Steps To Reproduce

The following example manifests reproduces the problem:

  1. common.yaml
services:
  web:
    container_name: test
    image: nginx
  1. compose.yaml
services:
  web:
    extends:
      file: common.yaml
      service: web
    depends_on:
      redis:
        condition: service_started
  redis:
    image: redis

Run docker compose config

You may see that the depends_on directive is missing from the resulting config file.

name: compose-test
services:
  redis:
    image: redis
    networks:
      default: null
  web:
    container_name: test
    image: nginx
    networks:
      default: null
networks:
  default:
    name: compose-test_default

Docker compose related commands are not working as expected (like, starting the related depends container redis ,in this case):

/tmp/compose-test# docker compose up web
[+] Running 1/0
 ✔ Container test  Created                                                                                                     0.0s
Attaching to test
...

Expected result (when running docker compose v2.31):
docker compose config

name: compose-test
services:
  redis:
    image: redis
    networks:
      default: null
  web:
    container_name: test
    depends_on:
      redis:
        condition: service_started
        required: true
    image: nginx
    networks:
      default: null
networks:
  default:
    name: compose-test_default

Expected behaviour of related docker-compose commands
docker compose up web

 docker compose up web
[+] Running 3/1
 ✔ Network compose-test_default    Created                                                                                     0.1s
 ✔ Container compose-test-redis-1  Created                                                                                     0.0s
 ✔ Container test                  Created                                                                                     0.0s
Attaching to test

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: 7
 Server Version: 27.4.1
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: local
 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: 5.15.0-130-generic
 Operating System: Ubuntu 22.04.5 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 3
 Total Memory: 7.751GiB
 Name: host
 ID: ffa6ddea-2af6-439e-9785-e76db6e48beb
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8

Anything else?

No response

@thaJeztah
Copy link
Member

@maxmarsakov
Copy link
Author

You are right it is a duplicate, thanks for pointing out the existing issue.

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

No branches or pull requests

2 participants