Output of docker-compose version
docker-compose version 1.24.0, build 0aa59064
docker-py version: 3.7.2
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.1.0j 20 Nov 2018
Output of docker version
Client:
Version: 18.09.3
API version: 1.39
Go version: go1.10.8
Git commit: 774a1f4
Built: Thu Feb 28 06:53:11 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.3
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: 774a1f4
Built: Thu Feb 28 05:59:55 2019
OS/Arch: linux/amd64
Experimental: false
Output of docker-compose config
(Make sure to add the relevant -f
and other flags)
ERROR: In file ./.env: environment variable name 'typesetting industry. Lorem Ipsum has been' may not contains whitespace.
LOREM="Lorem Ipsum is simply dummy text of the printing and
typesetting industry. Lorem Ipsum has been
"
This issue occurs in docker-compose 1.24.0
If we rollback to docker-compose 1.23.2 the issue is fixed:
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
docker-compose build
docker-compose build
nginx uses an image, skipping
Building php
....
`
ERROR: In file ./.env: environment variable name 'typesetting industry. Lorem Ipsum has been' may not contains whitespace.
I downloaded docker-compose-1.23.2 trying to reproduce your issue with this minimal setup :
docker-compose.yml:
version: "3"
services:
test:
image: alpine
command: 'echo hello $FOO !'
.env
FOO="bar
zot"
docker-compose up, both with 1.23 and 1.24 fail to run such a configuration.
Actually this feature was discussed on https://github.com/docker/compose/issues/3527 without any obvious fix on his way as env file support in docker engine do _not_ support multilines. Please note that using quotes around a value do not wrap a value as it does in plan shell, as bash isn't involved in parsing the .env file.
I was getting the same error and i did not use export in .env file. I have defined the variable like this and it worked for me
var:FOO
remove whitespace between environments
FOO = "bar
to
FOO="bar
I want to set the following contents into a .env file which i will use in my docker-compose
ENV=dev
MY_SERVICE_ACCOUNT='{
"type": "service_account",
"project_id": "my-gcp-project",
"private_key_id": "d8f6d9c92749",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwgWI8\naewdr8VbO2sRk1AgmYGCu9s=\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]",
"client_id": "740",
"auth_uri": "https://acnt.google.com/o/o2auth/auth",
"token_uri": "https://o2auth.googleapi.com/token",
"auth_provider_x509_cert_url": "https://www.googleapi.com/o2auth/vX/cert",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/xyz%40my-gcp-project.iam.gserviceaccount.com"
}'
MY_PHRASE="boo yaa"
It contains a JSON key of a GCP IAM Service Account in it.
I want to save that key in an environment variable called $MY_SERVICE_ACCOUNT
.
But i am getting a ...may not contain whitespace
error.
How do i bypass this? The Service Account key will certainly have whitespaces and stuff.
^ Facing the same issue. I have an environment variable that _has_ to have spaces
I've got the same problem, the issue was in CI/CD config, it was SERVICE_NAME:'value' instead of SERVICE_NAME=value.
Hey, guys, welcome to the club. Hope soon we can use multiline variables
Most helpful comment
I want to set the following contents into a .env file which i will use in my docker-compose
It contains a JSON key of a GCP IAM Service Account in it.
I want to save that key in an environment variable called
$MY_SERVICE_ACCOUNT
.But i am getting a
...may not contain whitespace
error.How do i bypass this? The Service Account key will certainly have whitespaces and stuff.