-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
.env
with export
Lines No Longer Works
#6511
Comments
I'm getting the same error in a similar environment (MAC OS). Some news about this without rollback version? |
My guess is that this is a backwards-incompatible See https://github.com/docker/compose/blob/master/CHANGELOG.md#bugfixes The best approach would be to avoid edit:typo |
Looks related to #6403 @shin- @hirochachacha |
I don't think that we ever supported this, but moreover, it was certainly never the intent: see our docs which clearly state
|
Presumably, https://docs.docker.com/compose/env-file/ I also checked the following test case with old
As you can see, I also tested
So, if I understand correctly, this is not a bug. |
Previously this was a warning and these lines were ignored. Now docker-compose fails with an error. My setup was relying on this behaviour. For now I've downgraded to 1.23.2 which has old behaviour. |
I really cannot understand the use-case of the old behavior... |
My usecase is currently to use default .env file to set COMPOSE_PROJECT_NAME and IMAGE_TAG The same file is also used by a python application that has a very long JSON array that is split across many lines using single quotes. .env is read from inside the container by python-dotenv which permits much wider syntax. I don't expect docker-compose to parse these values. The previous behaviour of ignoring them worked fine for me. With new behaviour I'll have to tell docker-compose not to use default .env file. |
Thank you for the response. But I don't think copying You maybe know, a work-around for multi-line support is using base64 encoding. |
I have a much different use-case for this, actually. As per the original comment, I like to Very handy to support both |
@hirochachacha we use .env for application default values. Then actual environment variables take precedence. Can we get old behaviour of warning of ignored lines back? |
I see. In the context of the original change, I'm fine with warning instead of error. |
Please note that ruby's dotenv recommends or allows you to store the Reference: https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use |
Also worth noting that while ignoring these lines is acceptable. Preferred behaviour is to support leading Most dotenv libraries allow optional leading export keyword:
EDIT: nodejs dotenv libraryies don't seem to allow |
Same mistake when using this new version
|
I was sharing a |
pip install docker-compose==1.23.2 |
I'm in favor of #6741 - add command line option that can disable loading .env feature. |
Not a fan of breaking people's setup by introducing a not backwards-compatible change, and then declaring it a "feature". |
Fixes docker#6741 Updates docker#6511
Fixes docker#6741 Updates docker#6511
Fixes docker#6741 Updates docker#6511 Signed-off-by: Hiroshi Ioka <[email protected]>
@hirochachacha I'm in favour of you not breaking anyone's setup and forcing people to change everything about their deployments just because you thought it would be a good idea to error out on lines that you can't/won't parse. HTML doesn't stop rendering because it encounters an invalid tag and this kind of logic would best apply here. |
Is there a way to ignore the env file? Because I have an env file not to docker-compose, but to my app. And when I run docker-compose ... it fails because is trying to use the env file |
Just speaking for my team-- we had conventions around using a (bash-formated) .env file before we adopted Compose. The previous behavior, where compose tried to read the file, ignoring lines it didn't understand, was annoying (but acceptable). We haven't upgraded to 1.24.x yet, but this is going to be pretty disruptive. |
Hallelujah! Switching to python-dotenv in #7150 solves my compatibillity issues as that's what my target app is using to parse .env python-dotenv has multi-line variables which is it's in my requirements https://github.com/bkeepers/dotenv#multi-line-values edit: It's not in any released version yet. |
Just downloaded Gitter.im https://gitlab.com/gitlab-org/gitter/webapp to test out and totally fails on this issue. Not sure why docker-compose couldn't continue to just ignore the |
This is fixed in 1.26.0-rc2 and later. 1.26.0 is not released yet. |
Description of the issue
I recently upgraded Compose to 1.24.0-rc1 (build
0f3d4dda
) and now Compose's automatic parsing of my.env
file fails. I keepexport
statements in my.env
file so I can easilysource
it in addition to using it as a standard.env
. In previous versions of Compose, this worked fine and didn't give me any issues, however with this new update I instead get an error about spaces inside a value.Context information (for bug reports)
Output of
docker-compose version
Output of
docker version
Output of
docker-compose config
(Make sure to add the relevant
-f
and other flags)Steps to reproduce the issue
.env
file with something likeexport FOO=1
docker-compose run --rm service bash
Observed result
Expected result
The container runs and
FOO
is correctly set in it.Stacktrace / full error message
Additional information
macOS 10.14.3
![image](https://user-images.githubusercontent.com/1403744/52430469-25601d00-2ad4-11e9-8f74-90dd071e5572.png)
Docker & Friends installed using Cask (
cask install docker-edge
)The text was updated successfully, but these errors were encountered: