-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
env_file variable values overwritten by .env values since v2.6.0 #9521
Comments
Pretty sure this is caused by the changes from #9512 Also for Docker Desktop 4.9.0 is also broken as it contains docker-compose 2.6.0, downgrading to Docker Desktop 4.8.2 fixes the issue, as this bundles docker-compose 2.5.1 |
This also affected us, and after quite a painful investigation implemented a workaround. What's particularly concerning is how it was decided that defaults/external env would have PRECEDENCE over the configurable It should be reversed (as is the previous behavior) I'm hopeful of this issue being acknowledged and fixed soon For what it's worth I logged a similar (in logic, if not exact cause as this) issue over a year ago: Despite all the feedback, it was ultimately auto-expired without any fix. |
Hello. This is a clear regression on 2.6.0. I'm currently working on it to make a patch release ASAP. |
Worked around this bug by using the --env-file flag with docker compose. e.g. docker compose --env-file .env.test up -d |
I am having a similar issue. I have seen the precedence chain to be:
This is a bummer as we would want to overwrite local @ulyssessouza would your fix apply to the |
Any updates on this one? It's about to fall off the first page of issues and I fear the next notification I get will be from the stalebot. |
@ulyssessouza As this doesn't seemed to be patched in 2.6.1, could you please give us a status update on your progress? |
The same issue was described in this issue: #9608 |
@ulyssessouza why is this taking 5 weeks to do "ASAP"? It's actively breaking production environments worldwide for goodness' sake... |
I've experienced this issue as well, and it was painful to find what was causing AWS credentials defined in my shell to leak into containers using local, fake keys from a .env file. Not me, but many people deploy their software on their single-server setups with compose. Some of these people use remote docker api instead of running compose via ssh. Some of these people would have some sort of credentials used in a .env file as well as defined in their shell. Please, do not make a security hole out of nowhere. Do not leak user credentials like this. Make it an explicit CLI option, to inherit shell variables, or just require users to explicitly pass variables with |
Description
Environment variable values specified via env_file in a docker_compose.yml are overwritten by the values in a .env file since v2.6.0.
Steps to reproduce the issue:
Describe the results you received:
Describe the results you expected:
This is the result of running the docker-compose config command with e.g. docker-compose v2.5.1:
Additional information you deem important (e.g. issue happens only occasionally):
If the environment variables are defined directly in the docker-compose.yml instead of via an env_file, they are not overwritten by the values in the .env file.
Output of
docker compose version
:Output of
docker info
:Additional environment details:
We noticed this problem in our gitlab pipelines using the docker:git image.
For now we just fixed the image version to docker:20.10.15-git to circumvent the problem.
The text was updated successfully, but these errors were encountered: