File: compose/compose-file/index.md, CC @londoncalling
Hey there! Please speak briefly to whether the env files towards the top or bottom of the list override env values that may be declared in multiple files. Thanks!
@shin- @dnephin can you address this question? I can add the details to the docs, but don't know the answer.
I'm not sure I understand the question. env always overrides env_file
@dnephin, given the following declaration in docker_compose.yml:
services:
some-service:
env_file:
- a.env
- b.env
And the following files:
# a.env
FOO=1
and
# b.env
FOO=hello
Will $FOO be 1 or hello?
The order of the files is significant, yes. It will be hello
Can we have this said explicitly on the docs please?
https://docs.docker.com/compose/compose-file/compose-file-v2/#env_file
@alanjds This was already added explicitly to the docs in the Version 3 Compose file per the referenced PR ^^ #3517, and is published at: https://docs.docker.com/compose/compose-file/#env_file
I've added further clarification in #3822, and will go ahead and update v2 and v1 with those same changes as well, in this case.
@londoncalling I see. Thanks.
Updates are merged, so this should be published soon. Thanks, @alanjds .
Most helpful comment
The order of the files is significant, yes. It will be
hello