-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Environment variables from env_file containing a "#" are truncated in V2 #9327
Comments
Actually what's happening is that it's just interpreting it as an inline comment. TEST_VAR="abc#def" |
@ulyssessouza Agree, but that's not documented. Anyway it is a breaking change from V1 to V2. Do you know if this breaking change is mentioned somewhere? |
IMO this is still an open issue because if this is intended behaviour than the documentation is wrong as mentioned/linked in my first post. Personally I find that the V1 behaviour which is officially documented and only accepts comments if the first character in a line is "#" makes more sense and is less error prone. |
@ceelian I agree. But at the same time I see that as a nice feature. So I'm proposing a change to the documentation to reflect the new behaviour |
@ulyssessouza Thank you for the quick PR and merge. Don't get me wrong but could you explain why you think the breaking change is a "nice feature"? I mainly see the disadvantage of a breaking change which will cause more work for the DevOps when they want/need to migrate to V2. But maybe I overlook some demanded advantages of the change. I am just curious I know you already decided and merged the PR. |
Description
Environment variables which contain "#" in the value are truncated starting from the "#" when using the env_file.
For example the line
TEST_VAR=abc#def
in an env_file will lead toTEST_VAR=abc
in the container instead ofTEST_VAR=abc#def
Regarding the official docs
only lines beginning with an "#" should be ignored, so the given example should work.
Steps to reproduce the issue:
TEST_VAR=abc#def
printenv | grep TEST_VAR
Describe the results you received:
TEST_VAR=abc
Describe the results you expected:
TEST_VAR=abc#def
Additional information you deem important (e.g. issue happens only occasionally):
It works on compose 1.29.2 it is not working on 2.3.3
Output of
docker compose version
:Output of
docker info
:The text was updated successfully, but these errors were encountered: