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] [v2.32.1] run service that extends other service does not fulfill depends_on #12423

Open
buxm opened this issue Dec 29, 2024 · 5 comments

Comments

@buxm
Copy link

buxm commented Dec 29, 2024

Description

With version 2.32.1, when running docker compose run <serviceA> and <serviceA> extends <serviceA_base> and <serviceA_base> depends_on serviceB, the depends_on clause is not fulfilled.
I.e. serviceA runs without starting serviceB.
This did not happen with prior versions (2.31.0 and before).

Steps To Reproduce

  1. On Linux (I tested with Ubuntu 24.04.1) install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin. docker-compose-plugin must be version 2.32.1
  2. put in the test directory the following compose.yaml file:
### compose.yaml
services:
  redis:
    image: redis

  job-base:
    image: busybox
    depends_on:
      redis:
        condition: service_started
    restart: no

  hello-world-job:
    extends:
      service: job-base
    command: echo Hello world

Because hello-world-job extends job-base, hello-world-job depends on the service redis, that must have been started before starting hello-world-job.
3. from within the test directory, run docker compose run --rm hello-world-job. The output is:

[+] Creating 1/1
 ✔ Network test_default  Created                                                                                                                                    0.2s
Hello world

hello-world-job has run but the container for the service redis has not been created.
4. install docker-compose-plugin version 2.31.0 (sudo apt install docker-compose-plugin=2.31.0*)
5. run docker compose run --rm hello-world-job. The output is:

[+] Creating 2/2
✔ Network test_default    Created                                                                                                                                  0.2s
✔ Container test-redis-1  Created                                                                                                                                  0.1s
[+] Running 1/1
✔ Container test-redis-1  Started                                                                                                                                  0.3s
Hello world

The container for the service redis has been created and started before running hello-world-job. This is the expected result.

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: 10
  Running: 6
  Paused: 0
  Stopped: 4
 Images: 11
 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: journald
 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: 88bf19b2105c8b17560993bee28a01ddc2f97182
 runc version: v1.2.2-0-g7cb3632
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-51-generic
 Operating System: Ubuntu 24.04.1 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 3.73GiB
 Name: e4wardtest01
 ID: 1722a4b8-f46f-4d00-8036-52be6254174b
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: true

Anything else?

No response

@paulbehrisch
Copy link

i'm getting the same behavior. Everything worked with Compose 2.31.0 and with 2.32.1 services are not being started.

@klutchell
Copy link

I came here to open the exact same issue, thanks for opening this!

Here is my minimal reproduction:

# docker-compose.a.yml
services:
  service1:
    image: nginx:alpine
# docker-compose.b.yml
services:
  service2:
    image: nginx:alpine
  service3:
    extends:
      file: docker-compose.a.yml
      service: service1
    depends_on:
      - service1

With v2.31.0 the depends_on property is present.

Docker Compose version v2.31.0
name: src
services:
  service1:
    image: nginx:alpine
    networks:
      default: null
  service2:
    image: nginx:alpine
    networks:
      default: null
  service3:
    depends_on:
      service1:
        condition: service_started
        required: true
    image: nginx:alpine
    networks:
      default: null
networks:
  default:
    name: src_default

With v2.32.1 the depends_on property is not included.

Docker Compose version v2.32.1
name: src
services:
  service1:
    image: nginx:alpine
    networks:
      default: null
  service2:
    image: nginx:alpine
    networks:
      default: null
  service3:
    image: nginx:alpine
    networks:
      default: null
networks:
  default:
    name: src_default

@thaJeztah
Copy link
Member

@buxm
Copy link
Author

buxm commented Dec 30, 2024

Yes, I think it's duplicate of #12421, although the depends_on is placed differently.
Sorry, I failed to check closed issues before opening a new one.

@buxm buxm closed this as completed Dec 30, 2024
@buxm buxm reopened this Jan 25, 2025
@buxm
Copy link
Author

buxm commented Jan 25, 2025

My understanding is that v2.32.3 should have fixed this issue. However v2.32.4 still shows the same behaviour.

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

4 participants