Skip to content
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

Regression: newline in quoted string for .env broken #8626

Closed
tracker1 opened this issue Sep 15, 2021 · 2 comments
Closed

Regression: newline in quoted string for .env broken #8626

tracker1 opened this issue Sep 15, 2021 · 2 comments
Labels

Comments

@tracker1
Copy link

tracker1 commented Sep 15, 2021

Description of the issue

When importing a .env file with a quoted string, containing a new-line character (multi-line environment variable), it is broken in 2.x (v2.0.0-rc.3), this is working correctly in 1.x (1.29.2)

Context information (for bug reports)

docker-compose.yml

version: "3.3"
services:
  test:
    image: alpine
    command: 'echo "hello $FOO!"'

.env

FOO="foo
bar
baz"

Docker Version

❯ docker version
Client: Docker Engine - Community
 Cloud integration: 1.0.17
 Version:           20.10.8
 API version:       1.41
 Go version:        go1.16.6
 Git commit:        3967b7d
 Built:             Fri Jul 30 19:54:02 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.8
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.6
  Git commit:       75249d8
  Built:            Fri Jul 30 19:52:10 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.9
  GitCommit:        e25210fe30a0a703442421b0f60afac609f950a3
 runc:
  Version:          1.0.1
  GitCommit:        v1.0.1-0-g4144b63
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output - Using Compose V1 (Working)

❯ docker-compose version
docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

❯ docker-compose config
services:
  test:
    command: 'echo "hello foo

      bar

      baz !"'
    image: alpine
version: '3.3'

❯ docker-compose up
Starting dc1_test_1 ... done
Attaching to dc1_test_1
test_1  | hello foo
test_1  | bar
test_1  | baz !
dc1_test_1 exited with code 0

Output - Using Compose V2 (Broken)

❯ docker compose version
Docker Compose version v2.0.0-rc.3

❯ docker compose config
invalid variable name "baz\""

❯ docker compose up
invalid variable name "baz\""

Additional information

  • OS; Ubuntu 20.04.2 LTS on Windows 10 x86_64
  • Kernel: 5.4.72-microsoft-standard-WSL2
  • Installation: Docker Desktop for Windows with WSL2 integration.
@ndeloof
Copy link
Contributor

ndeloof commented Sep 16, 2021

depends on joho/godotenv#118

@ndeloof
Copy link
Contributor

ndeloof commented Oct 6, 2021

compose v2.0.0 uses a custom fork of joho/godotenv => github.com/compose-spec/godotenv.
This fork includes joho/godotenv#118 to support multi-line values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants