-
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
[BUG] Environment Variable handling is maddeningly inconsistent #11865
Comments
interpolation works for sure, in most cases confusion comes from setting values based on env file, and how those get loaded with some default paths.
actually, this is the opposite. all attribute handle interpolation the same way, and when it comes to list of values to be set, this makes things harder for user as this assumes a fixed number of variables.
This one is (yet another) case where user get confused between interpolation and container environment being set by If you have a specific bug to report, please give more details. I only can read "I'm frustrated this didn't worked out of the box" which won't bring us anywhere. I acknowledge the docs are bad documented this feature and need some love |
How the heck do you expect me to file a "specific bug report" when there is no way of knowing how this thing is supposed to be working in the first place? I did just file a report, as have countless other people, and Dockers' developers response is "You just don't know how to use it. Oh and the docs are crap so HAHA sucks to be you." The only thing that works reliably is if I directly set, or pull an OS environment variable from the immediate environment, in the docker-compose.yaml file. eg: services:
my-service:
environment:
MY_VAR: my_val
MY_VAR2: $MY_VAR2
MY_VAR3: ${MY_VAR3:-default_val} With external environment files, the only thing I have been able to get working semi-reliably is And heaven forbid I I don't know or care if it's a code issue or a documentation issue. It is not only a bug, but a CRITICAL bug. I appreciate you've attempted to get some progress on this, but clearly none of the other developers consider this a problem because docker/docs#19481 has been stalled for months. If variable handling /w docker compose is so challenging that it cannot even be documented properly, it should be ripped out of the product entirely. As things stand, given Docker's reach, this has probably cost millions in lost productivity. Maybe Docker should spend less time coming up with ways to squeeze it's user base for money, and more time making a product it's users would be willing to pay money for. |
Please provide an illustration example so I can confirm this is a bug or explain / propose docs improvements accordingly
same request. Please provide an illustration example if this sounds like a bug
I can understand some frustration, but please also adopt a respectful tone. The team is working hard to maintain Compose with thousands users and we don't have much bandwidth to answer everyone. If you want some assistance to better understand how Compose works, or get your issue considered and fixed, just consider we also have to manage our priorities and a well reported issue with an example we can test and adopt as a new test case will bring faster answer/fix vs just complaining. |
There is definitely inconsistency with the ways that environment variable interpolation happens, some due to confusion based on the similar naming of For example, the Additional information section of https://docs.docker.com/compose/environment-variables/set-environment-variables/#use-the-env_file-attribute states
but this does not appear to be true of a Similarly, https://docs.docker.com/compose/environment-variables/envvars/ indicates that one should be able to override
but that also does not appear to be possible (understandable, but incorrectly documented). |
@roverwolf Having the same issue as you with that documentation, I've pulled it out into its own issue as needing a doc patch. I'd rather the underlying functionality was changed, but, the docs being fixed is a good start. |
Description
According to
https://docs.docker.com/compose/compose-file/12-interpolation/
:In practice, this is untrue. Variable interpolation is all over the map. Sometimes they work, sometimes they don't.
Different settings handle interpolation differently. (eg: #4249, or ports)
Different files handle interpolation differently. (eg: #11755)
This is causing needless confusion and frustration, and wastes countless hours of people's time with needless trial and error.
Variables should work across the board. If you're reading variables, regardless of source, variable interpolation should occur. If you're applying settings, regardless of the type, variable interpolation should occur. Heck, if you want to have an entire docker-compose yaml stanza pulled from a variable, do variable interpolation.
Steps To Reproduce
No response
Compose Version
Docker Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: