-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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] Using multiple compose files with their own includes will only load relatively to the first compose file #11944
Comments
Same issue occurs on docker info:
|
relative paths always apply based on the "project directory" with is the parent folder for the first compose file. There's unfortunately no syntax to tell compose to consider a path "relative to the current file". Same rule applies to all relative paths, not just |
Can this please be reopened, because the issue is not as simple as you describe. Include explicitly is being referenced as loading files relatively to the included file. So the first included file in a relative directory is found correctly, the second one is not. This difference between both includes is not predictable, and not at all what is documented in the documentation. |
I am not asking for relative paths here, I'm asking that if relative paths are being documented, that they work in a predictable way. Relative paths only working when adding compose files in a certain order is not predictable at all. This issue happens both when adding command line flags for multiple files as being loaded by COMPOSE_FILE with a separator. |
For anyone running into this, what worked for us is adding a compose.yaml file at the root of your project that is completely empty, and include it as the first COMPOSE_FILE. Somehow it makes all relative paths work against that "root" directory. |
Description
Running docker compose with two compose files, both including another yaml file, it will only look for the included files relatively to the first loaded compose file.
I would expect both includes to happen based on the path of the compose.yaml file being loaded.
Steps To Reproduce
dir1/compose.yaml
file and adir1/dir1-included.yaml
file - add some services to them, and use include in thecompose.yaml
file to include thedir1-included.yaml
filedir1/compose.yaml
dir1/dir1-included.yaml
dir2/compose.yaml
file and adir2/dir2-included.yaml
file - add some services to them, and use include in thecompose.yaml
file to include thedir2-included.yaml
filedir2/compose.yaml
dir2/dir2-included.yaml
docker compose -f dir1/compose.yaml -f dir2/compose.yaml up
and it will complain about thedir2-included.yaml
file not being founddocker compose -f dir2/compose.yaml -f dir1/compose.yaml up
and it will complain about thedir1-included.yaml
file not being founddir1/compose.yaml
anddir2/compose.yaml
to see the same thing happening, depending on the order of filesCompose Version
Docker Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: