Skip to content

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

Merged
glours merged 2 commits intocompose-spec:mainfrom
infraAnchor:fix-extends-include-order
Apr 1, 2026
Merged

Fix: Process includes before extends for proper attribute inheritance#853
glours merged 2 commits intocompose-spec:mainfrom
infraAnchor:fix-extends-include-order

Conversation

@infraAnchor
Copy link
Copy Markdown
Contributor

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
@glours glours enabled auto-merge (rebase) April 1, 2026 06:55
@glours glours merged commit 65af4e5 into compose-spec:main Apr 1, 2026
8 checks passed
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.

3 participants