.env file doesn't get resolved
omertuc opened this issue · 8 comments
what Compose version are you using?
Do you have a test repo that we would be able to test and implement this with? From what I understand, we would only be able to implement this for .env files locally hosted on the developer's computer, but it is something we can add as an improvement
what Compose version are you using?
$ docker-compose --version [22:57:27]
docker-compose version 1.21.0, build unknown
Do you have a test repo that we would be able to test and implement this with? From what I understand, we would only be able to implement this for .env files locally hosted on the developer's computer, but it is something we can add as an improvement
Sure I'll set one up and link it here once it's ready example repo. And of-course it's only for local .env
file. docker-compose
automatically looks for .env
files in the same directory as the docker-compose.yml
file
Check out python-dotenv, it might help you to develop this feature. It's what more recent versions of docker-compose
use to parse the .env
file (my version, 1.21.0
, used manual buggy parsing, newer versions rely on python-dotenv
)
Awesome! I may go the route of reading the .env file specified in env_file but will need to do more research.
Thank you for your feedback and welcome any contributions/additional feedback
env_file is entirely different from .env
, it's not what this issue is about.
.env
is used for variable substitution inside the docker-compose.yml file itself . The .env
file does not affect the environment variables inside the container. Relevant documentation: this and this
However, env_file
is a per-container-configuration for applying environment variables from a specified *.env
file inside the container itself. Relevant documentation: this
(Sorry if the bold text sounds rude, it's just a bit confusing so I'm highlighting the important stuff)
Thanks for the clarification. I see what we have to do now and the fix should be rather quick!
Thank you,
Michael
@omertuc fix is in. please test and let us know if you have any issues.
Will look into optimizing handling env file