-
Notifications
You must be signed in to change notification settings - Fork 485
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
Replicate environment variable from local environment fails with default .env
-file
#1011
Comments
Behaviour in Docker Compose (as described in documentation) is what I expected. |
It seems that if I interpolate value in
On the other hand if I set environment variable as local environment variable then it is replicated correctly:
|
fixes containers#1011 The problem before this fix: if the environment section contains assignments without value, such as: environment: - SOME_VAR it will get added to the podman.args as is, just "-e SOME_VAR" which is likely not intended - at least from what i can tell, in these situations vars should be looked up in the environment added by, for example .env files. The fix: if an entry in the environment section doesn't contain a value, we look it up in compose.environ and add it if found.
not sure if i'm doing this correctly, but this issue has bothered me and i've implemented a fix that seems to work great in my (admittedly short) tests: main...terminatorbs:podman-compose:patch-1 sorry i'm not knowledgeable to add tests for this. also no worries if the change doesn't make it into a PR, i just wanted a fix for myself because for example Jitsi has like hundreds of env vars passed like this and i thought i'd rather fix it here than write hacky scripts that modify compose files to add interpolation to every environment: entry. edit: the code change is in the commit, but here it is with 2 comments added that kinda explain what it does:
this is (as of right now) from line 1100 in podman-compose.py, in the container_to_args() function. edit 2: |
Describe the bug
If environment variable value is defined in default
.env
-file and environment variable is replicated incompose.yml
file, environment variable is not passed to containerTo Reproduce
.env
:compose.yml
:Expected behavior
Environment variable
TEST
should be included in outputActual behavior
Environment variable
TEST
is not included in outputOutput
My environment:
The text was updated successfully, but these errors were encountered: