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

Docker-compose doesn't accept environment variables with dot symbol (".") #8862

Closed
Serg675 opened this issue Nov 1, 2021 · 12 comments · Fixed by compose-spec/compose-go#271

Comments

@Serg675
Copy link

Serg675 commented Nov 1, 2021

Hello,

The docker-compose (Docker Desktop for Windows) throws error and quits if environment variable contains dot symbol (".").
The error in "unexpected character "." in variable name near ..."

Don't know if it's new issue or not since haven't used docker-compose before.

Below is versioning information.

Client:
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:58:50 2021
OS/Arch: windows/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:31 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

Docker Compose version v2.0.0

@stephen-turner stephen-turner transferred this issue from docker/for-win Nov 1, 2021
@solvaholic
Copy link

See also #8507

@skobkin
Copy link

skobkin commented Dec 16, 2021

Same problem. It's currently impossible to set a variable with an IP address in .env file.

@nevergone
Copy link

Related commit:
https://github.com/compose-spec/godotenv/blob/655269e2565760ac457e473904300398c6150d47/parser.go#L113

If the variable name contains a dot in the env_file key file, this will cause an error in docker-compose 2.x. If the same variable is below environment key, it works.
This worked perfectly fine under 1.29.x, please reset it. Why does docker-compose need to handle this? Why doesn't the container shell do this?

@mediaessenz
Copy link

I have the same problem!
Since updating to Docker Compose version 2.2.3 I'm not able to build containers where a service includes env_file's containing "." in the environment variable names:

docker-compose.yml

version: '3.7'
services:
  app:
    build:
      context: .
      dockerfile: Dockerfile.development
    env_file:
      - environment.yml

environment.yml

fpm.global.process_control_timeout=5m
docker-compose build app

Results in:
unexpected character "." in variable name near "fpm.global.process_control_timeout=5m\n"

@timohuovinen
Copy link

Same problem here, using a legacy beast that can't be changed.

@nevergone
Copy link

Docker compose all 2.x versions is affected.

@Mehrdad-Dadkhah
Copy link

same problem

@vivek-rao-1985
Copy link

I'm happy to open a PR for this, looks like someone just needs to add '.' to this switch case.

@vivek-rao-1985
Copy link

@Serg675 did you manage to find a workaround for this? the godotenv repo doesn't accept any pull requests.

@Serg675
Copy link
Author

Serg675 commented May 26, 2022

@vivek-rao-1985
You can set environment variable with dot it the compose YAML file itself in the "environment:" section. It's accepted there. It doesn't work if to do it in outside file "env_file:"

@nevergone
Copy link

Docker-compose 2.6.0 is affected.
ping: @glours @ulyssessouza @maxcleme

@glours
Copy link
Contributor

glours commented May 30, 2022

Yes we know, we didn't had time to add this one to the latest release, will try to include it in the next one and will ping you when it will be available in the v2 branch

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

Successfully merging a pull request may close this issue.

9 participants