Thanks to visit codestin.com
Credit goes to github.com

Skip to content

docker cannot pass newlines from variables in --env-file files #12997

@hudon

Description

@hudon

Description of problem:

I have a .env file with variables like TEST=hello\nworld. When passed in with docker run --env-file .env, the process sees hello\nworld, rather than:

hello
world

There seems to be no way for Docker to actually send a newline character with --env-file, only the two characters \ and n.

To reproduce:

# .env
TEST=hello\nworld 

expected output:

$ docker run --env-file .env --rm container  ruby -e 'puts ENV["TEST"]'
hello
world

actual output:

$ docker run --env-file .env --rm container  ruby -e 'puts ENV["TEST"]'
hello\nworld

docker version:

Client version: 1.6.0
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 4749651
OS/Arch (client): darwin/amd64
Server version: 1.6.0
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 4749651
OS/Arch (server): linux/amd64

uname -a: Darwin ip-192-168-1-138.ec2.internal 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64

Environment details (AWS, VirtualBox, physical, etc.): boot2docker

docker info:

Containers: 6
Images: 88
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 100
 Dirperm1 Supported: true
Execution Driver: native-0.2
Kernel Version: 3.18.11-tinycore64
Operating System: Boot2Docker 1.6.0 (TCL 5.4); master : a270c71 - Thu Apr 16 19:50:36 UTC 2015
CPUs: 8
Total Memory: 1.961 GiB
Name: boot2docker
ID: 3U2N:T7BZ:CAWM:PP3R:LTA5:LXVU:JSAL:MKE3:PQUM:VQ3T:TOWO:FSKH
Debug mode (server): true
Debug mode (client): false
Fds: 32
Goroutines: 48
System Time: Tue May  5 19:50:22 UTC 2015
EventsListeners: 0
Init SHA1: 9145575052383dbf64cede3bac278606472e027c
Init Path: /usr/local/bin/docker
Docker Root Dir: /mnt/sda1/var/lib/docker

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions