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.
Description
According to the documentation, the
depends_ondeclaration should not be derived when extending a service:However, if you extend a service that depends on a service that is not declared in the compose file, an error is issued:
I didn't expect an error because according to the documentation
depends_onshould never be shared between services with extends.Steps To Reproduce
compose.yaml
compose2.yaml
run command:
Compose Version
Docker Environment
Anything else?
I reduced the configuration to only the parts causing the problem.