Skip to content

Fix: Process includes before extends for proper attribute inheritance#853

Open
infraAnchor wants to merge 1 commit intocompose-spec:mainfrom
infraAnchor:fix-extends-include-order
Open

Fix: Process includes before extends for proper attribute inheritance#853
infraAnchor wants to merge 1 commit intocompose-spec:mainfrom
infraAnchor:fix-extends-include-order

Conversation

@infraAnchor
Copy link

Relates to docker/compose#13606

Services using 'extends' don't inherit environment variables from the base service when that base service gets attributes from an 'include' directive.

Root Cause:
'extends' was processed before 'includes', meaning extended services couldn't access attributes that came from included files.

Solution:
Process includes first, ensuring all service attributes are fully merged before extends resolution happens.

Testing:
Regression test added in docker/compose to verify environment variable inheritance across include+extends combinations.

Fixes issue where services using 'extends' don't inherit environment
variables from the base service when that base service gets attributes
from an 'include' directive.

The bug occurred because 'extends' was processed before 'includes',
meaning extended services couldn't access attributes that came from
included files.

By processing includes first, we ensure all service attributes are
fully merged before extends resolution happens, allowing proper
inheritance across include+extends combinations.

Signed-off-by: infraanchor <olaitanfalolu02@gmail.com>
@infraAnchor infraAnchor requested a review from ndeloof as a code owner March 6, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants