[BUG] env_file
property on include top-level element is relative to current directory instead of the directory of compose.yml
#11577
Labels
Description
The documentation for the include top-level element states the following about the
env_file
property:Knowing that compose will use the
.env
file found on theproject_directory
, one would expect it to do the same for the environment files defined on theinclude
top-level element (making use of theproject_directory
as relative path forenv_file
).Yet, in practice it only will look at the current working directory and stop there, showing an error similar to this:
Couldn't find env file: .../.env.defaults
.This makes the
env_file
property kind of useless, as it will break the usage of the compose config from anywhere but the project root.I think this may be related to issues #11392 and #11405.
Steps To Reproduce
Run the hello-world container from the project root, which should work fine:
docker compose run hello-world
Enter into a subdirectory and repeat the previous command; it will fail with a message similar to this one: "Couldn't find env file: include/.env.main"
cd include && docker compose run hello-world
Compose Version
Docker Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: