You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given an environment file where keys have a quoted value:
FOOBAR="12345"
BARFOO="xxxxxxxxxxxxxxxx"
Where in any application context the value when printed is unquoted, e.g. python:
print(os.getenv('FOOBAR'))
12345
The docker run --env-file has an unexpected behaviour, where the output includes the quotes. For example, given the use case above for the same app in-docker the print output would look like:
Unfortunately that format is a breaking change introduced in compose, and I wonder if that change was intentional or because they conflated the format for the .env file and --env-file, which are very different. The --env-file format was designed to be a plain NAME=value, no parsing, and no handling on quotes.
It looks like this is a duplicate (or very close to) an existing ticket; let me close this one to prevent the conversation from diverging, but feel free to comment on the other ticket;
Description
Given an environment file where keys have a quoted value:
Where in any application context the value when printed is unquoted, e.g. python:
The
docker run --env-file
has an unexpected behaviour, where the output includes the quotes. For example, given the use case above for the same app in-docker the print output would look like:"12345"
The parser for docker compose confirms that quotes are supported (optionally) as found in https://docs.docker.com/compose/compose-file/05-services/#env_file
Reproduce
Create a env file in the host:
Docker run ubuntu and execute echo env var in bash :
Dump the value for FOOBAR, which is expected to be 12345 (unquoted), it should:
Here, you can assert that the default behaviour is to output it unquoted as follows:
Expected behavior
The value should be unquoted as documented for docker compose (https://docs.docker.com/compose/compose-file/05-services/#env_file)
docker version
Client: Docker Engine - Community Version: 24.0.5 API version: 1.43 Go version: go1.20.6 Git commit: ced0996600 Built: Wed Jul 19 19:44:22 2023 OS/Arch: darwin/arm64 Context: desktop-linux Server: Docker Desktop 4.24.0 (122432) Engine: Version: 24.0.6 API version: 1.43 (minimum version 1.12) Go version: go1.20.7 Git commit: 1a79695 Built: Mon Sep 4 12:31:36 2023 OS/Arch: linux/arm64 Experimental: false containerd: Version: 1.6.22 GitCommit: 8165feabfdfe38c65b599c4993d227328c231fca runc: Version: 1.1.8 GitCommit: v1.1.8-0-g82f18fe docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Additional Info
No response
The text was updated successfully, but these errors were encountered: