-
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
docker-compose overrides values from .env with host value if present in host's environment variables #9578
Comments
I am facing this same issue - any word on a fix? |
I don't think this is fixed by #9636
the expected output would be here is an example running docker directly that demonstrates the correct behavior (ie. environment variables shouldn't affect a docker invocation):
the above tests were made with the latest docker desktop on mac os:
|
Could you please test that with |
Hi, I have the same problem. I want to use .env variables, but they get overridden by shell environment variables (docker compose v 2.10). Does anybody know how to force the .env variables over the host variables? |
Hello @xstast24. The precedence mechanism is documented in https://docs.docker.com/compose/envvars-precedence/ |
Description
docker-compose env_file overwrites values from .env with host value if present in host's environment variables. Otherwise correctly applies the value from .env file
Steps to reproduce the issue:
env_file:
Describe the results you received:
The value for the env var is the same as the host
Describe the results you expected:
The value for the env var from the .env file
Additional information you deem important (e.g. issue happens only occasionally):
I downgraded docker-compose to v.2.5.1 and this issue is resolved
Output of
docker compose version
:Output of
docker info
:Additional environment details:
The text was updated successfully, but these errors were encountered: