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] depends_on is NOT ignored when extending from a service #12360

Closed
LennyN95 opened this issue Dec 8, 2024 · 0 comments · Fixed by compose-spec/compose-go#718
Closed
Assignees
Labels

Comments

@LennyN95
Copy link

LennyN95 commented Dec 8, 2024

Description

According to the documentation, the depends_on declaration should not be derived when extending a service:

volumes_from and depends_on are never shared between services that use extends. These exceptions exist to avoid implicit dependencies; you always define volumes_from locally. This ensures that the dependencies between the services are clearly visible when reading the current file. The local definition also ensures that changes to the referenced file do not break anything.
https://docs.docker.com/compose/how-tos/multiple-compose-files/extends/

However, if you extend a service that depends on a service that is not declared in the compose file, an error is issued:

service "aaa" depends on undefined service "bbb": invalid compose project

I didn't expect an error because according to the documentation depends_on should never be shared between services with extends.

Steps To Reproduce

compose.yaml

name: setup

services:
   aaa:
      depends_on:
          bbb:
             condition: service_healthy
   bbb:

compose2.yaml

name: setup

services:
   aaa:
      extends:
         file: compose.yaml
         service: aaa

run command:

docker compose -f compose2.yaml up -d

Compose Version

Docker Compose version v2.30.3-desktop.1

Docker Environment


Anything else?

I reduced the configuration to only the parts causing the problem.

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

Successfully merging a pull request may close this issue.

2 participants