Repository navigation
Conversation
The page claimed that every path must be written relative to the base Compose file, which contradicts the Relative paths section on the same page. A service pulled in with extends keeps the relative paths it declares, resolved against the file that declares them. Replace the warning with a note that states the actual behavior and points to the example.
✅ Deploy Preview for docsdocker ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The page opens with an
[!IMPORTANT]block stating that "all paths must bedefined relative to the base file", which contradicts the
## Relative pathssection further down the same page. #26501
reports the contradiction and asks which one is right.
The
## Relative pathssection is right. Thefilepath of anextendsattribute is resolved relative to the main Compose file, while relative paths
declared by the service being extended are resolved relative to the Compose file
that declares them. The example on that page already shows the outcome
(
env_file: ./container.envinsidecommons/compose.yamlbecomes../commons/container.env).This change keeps the section, and replaces the incorrect warning with a note
that states the actual behavior. Deleting the warning outright was the first
option in the issue, but the note also carries the part that is true:
fileitself is relative to the main Compose file.
Evidence from the Compose specification and compose-go v2.16.2
05-services.mdunder "Finding referencedservice": a relative
filepath "is considered as relative to the location ofthe main Compose file".
compose-gov2.16.2, the version pinned bydocker/compose'sgo.mod:loader/extends.goloads the referenced file withResolvePaths = falseand a comment saying "we do relative path resolution after file has been
loaded", then calls
paths.ResolveRelativePaths(source, relworkingdir, remotes).relworkingdirisloader.Dir(refPath), the directory of the referencedfile, not the directory of the main Compose file.
paths/resolve.gojoins each relative path (services.*.env_file.*.path,services.*.volumes.*,services.*.build.context, and so on) onto thatdirectory.
services.*.extends.filehas its own resolver, so a nestedextends.fileis resolved against the file that declares it.
-fis the case where paths resolve against thefirst file, which
merge.mddocuments. The warning here applied that rule toextends.Verification
npx --no-install rumdl fmtandnpx --no-install rumdl checkon thechanged file: no issues.
valewith the repository configuration on the changed file: 0 errors, 0warnings and 0 suggestions. The
i.e.in the old wording is gone with therewrite.
docker buildx bake validatewasn't run locally.
Related issues or tickets
Closes #26501
Reviews
Generated by DeepSeek Harness, a coding agent. It drafted the change and this
description.