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

After migrating to 1.17 docker compose ignores depends_on if there is extends block in the service definition #8062

Closed
DiverOfDark opened this issue Jan 10, 2025 · 4 comments
Assignees
Labels
kind/bug Something isn't working triage/by-design The behavior is expected and not a bug

Comments

@DiverOfDark
Copy link

DiverOfDark commented Jan 10, 2025

Actual Behavior

we have docker compose file which define service something like this:

  myservice:
    extends:
      file: docker-compose.base-service.yml
      service: base
    image: '...'
    labels:
      - "a=b"
    environment:
      ENV: value
    depends_on:
      mysql:
        condition: service_healthy
      rabbitmq:
        condition: service_healthy
      traefik:
        condition: service_healthy

when I try to run docker-compose up -d myservice - then only myservice is started, and mysql/rabbit/traefik are skipped.
If I remove extends block and inline the contents - everything works as before.

in 1.16 this worked as expected.

Steps to Reproduce

Create a docker compose file with extends and service. specify depends_on in docker-compose (not extends).

Result

Instead of bringing up container with dependencies - I see only this. Also note the total count of services is 0.

docker compose up -d myservice
[+] Running 1/0
 ✔ Container folder-myservice-1  Running     

Expected Behavior

I expect all dependent containers are started and waited for if health check if specified:

docker compose up -d myservice
[+] Running 1/4
 - Container folder-traefik-1            Starting
 - Container folder-mail-1                Starting
 - Container folder-mysql-1               Starting
✔ Container folder-myservice-1            Running 

Additional Information

No response

Rancher Desktop Version

1.17

Rancher Desktop K8s Version

n/a

Which container engine are you using?

containerd (nerdctl)

What operating system are you using?

Windows

Operating System / Build Version

Windows 11. Same behavior on MacOS with Arm

What CPU architecture are you using?

x64

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

No response

@DiverOfDark DiverOfDark added the kind/bug Something isn't working label Jan 10, 2025
@jandubois
Copy link
Member

Can you please include a working repro case, i.e. a compose file we can run locally to reproduce the issue?

@jandubois
Copy link
Member

I'm also confused that you say you are using containerd (nerdctl), but then show docker example commands. Please provide the exact configuration that has this problem!

@jandubois jandubois added the triage/needs-information Further information is requested label Jan 14, 2025
@jandubois jandubois self-assigned this Jan 14, 2025
@DiverOfDark
Copy link
Author

DiverOfDark commented Jan 15, 2025

minimal example:

docker-compose.yml:

services:
  myservice-a:
    extends:
      file: base-file.yml
      service: base
    depends_on:
      - myservice-b

  myservice-b:
    extends:
      file: base-file.yml
      service: base

base-file.yml:

services:
  base:
    image: rabbitmq:latest

if you try to docker compose up myservice-a -> then service myservice-b is not started.


yet, if you try to inline base-file.yml:

services:
  myservice-a:
    image: rabbitmq:latest
    depends_on:
    - myservice-b

  myservice-b:
    image: rabbitmq:latest

if you try to docker compose up myservice-a -> then both service are started.


Re containerd - my bad, I was wrong, it was dockerd, but I believe problem might be in docker compose plugin.

@jandubois
Copy link
Member

This seems to be an intentional change in the docker compose behaviour to align it with the compose spec: compose-spec/compose-go#718

@jandubois jandubois added triage/by-design The behavior is expected and not a bug and removed triage/needs-information Further information is requested labels Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working triage/by-design The behavior is expected and not a bug
Projects
None yet
Development

No branches or pull requests

2 participants