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
Add .env file support to COMPOSE_ENV_FILES #11122
Comments
I'm :-1 on this. |
As it currently stands (with
In both cases if you want
In my opinion all 4 of the above cases are not a great developer experience since it involves every person who runs your project to customize how they call This issue (and the original discussion) allows This would be a great addition because now you have a per-project solution to interpolate whatever env files you need and no one needs to modify how they call |
indeed, this is what environment variables are for: tweak your environment so the same command will behave in a distinct way. |
Right but now imagine you have 30 developers who are working on an app. Now to run the project all 30 developers need to run Likewise, imagine you open source a project that's used by thousands of folks. Suddenly you can't just |
having multiple env file suggest you want to combine those to cover multiple scenarios. If the default |
It wouldn't be automagical. It would be dependent on you explicitly setting There's a number of use cases where you couldn't or wouldn't want to set everything in a single In any of the above cases you could or would want Docker Compose to interpolate, |
I think one last thing to bring up are the existing Besides covering the use case description that spawned this feature, from an intuitiveness perspective the expected outcome is |
what if .env defines IMHO this really goes way beyond usability rules, and I'll veto such a feature |
Ok no problem. You may want to consider reverting When you put both of those together, I'm not sure how much value there is to having |
other |
Has there been any news to this? Official documentation is misleading, it does not work as described there: https://docs.docker.com/compose/environment-variables/envvars/#compose_env_files I am getting this in case I want to load vars from other env specified (upon up -d).
This would be an example of additional .env:
Content of .env.additional:
|
I am exactly in this use case and it's extremely sad to see such an issue that was raised and then it was vetoed. Unfortunately this is not the first time that this has happened with Even the author of the feature (@glours ) admitted that not adding support via the Plenty of people that use this tool have different use cases and requirements, that is fine and expected. Yes you can't support every single use case but many of them are downright obvious and more than relevant, like in this scenario. I cannot understand why this project goes so out of their way to reject help from other users while at the same time making their experience worse. Just my 2 cts. |
@ndeloof then how is one supposed to set the Having to manually export a variable every single time or having to add lengthy options to a command is completely impractical. More "permanent" solutions like aliasing the command or adding such a variable export to So if we can't have this variable defined in Thanks |
Description
This is in relation to the new feature introduced in this PR: #11061
When
COMPOSE_ENV_FILES
is defined in an.env
file it has no effect. This is a potential oversight / bug.Here's a reproduceable example:
# .env COMPOSE_ENV_FILES=.env,.env.local DOCKER_RESTART_POLICY=yes
# .env.local DOCKER_RESTART_POLICY=no
If you run
docker compose config
the value of restart isyes
but it would be expected that it'sno
through the logic of:docker compose
was called without explicitly defining any--env-file
flags which means it will look for.env
by defaultCOMPOSE_ENV_FILES
env var will be used which says to interpolate the.env
file and then.env.local
no
should be setIf you run
COMPOSE_ENV_FILES=.env,.env.local docker compose config
then everything works as expected but this requires altering your shell or creating a custom alias to run docker compose with that set. The original use case was to allow for runningdocker compose
commands without modification.The text was updated successfully, but these errors were encountered: