-
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
Bad parsing of hashes in env files #9509
Comments
I tested this locally and it worked as-expected on Compose v2.2.3 (Desktop v4.5, Engine 20.10.12). Then I updated my Docker Desktop to the latest (Desktop v4.8.2), and now on Compose v2.5.1, where its
edit: put update in below comment. |
Update This is the expected parsing of that .env value. You'll want to wrap the value in quotes if you want to use So instead of This change was introduced in compose-go v1.10 in this PR, used in Docker Compose v2.3.0+. |
Hi @inFocus7! Thanks for pointing out the commit. IMHO, this is a parsing error. env files come from *nix and, to my knowledge, no shell processes the strings in this way. An inline comment not only needs to start with a hash, but also with a whitespace in front of it. TEST1=123 # inline comment
TEST2=123#not-an-inline-comment
TEST3="123 # not a comment either" GitHub's syntax highlighter agrees with this ;) |
Thanks @nuno-andre for reporting this issue! |
Since this is the top result on Google (for my search), adding my findings here: According to the release notes, compose-go v1.2.9 includes the linked PR, and according to Docker Compose release notes, Compose v2.7.0 changes the compose-go version to v1.2.9 in this PR. Somewhere along the way, I think this regressed - I was still seeing the issue (Compose 2.10.2 as part of Docker Desktop for Mac 4.12.0). I did some more searching - another PR was released in compose-go v1.6.0, which in turn is included in Compose v2.11.2. More details about the fix are in issue #9879 (Compose repo). Docker Desktop updates approximately monthly (source - link anchor scrolls too far) and includes the newest Compose version (source). |
Description
Bad parsing of hashes in env files.
Steps to reproduce the issue:
.env
filecompose.yaml
Describe the results you received:
Describe the results you expected:
E.g.:
Additional information you deem important (e.g. issue happens only occasionally):Output of
docker compose version
:Output of
docker info
:Additional environment details:The text was updated successfully, but these errors were encountered: