giraff giraff - 1 year ago 371
YAML Question

How can I pass a multi-line variable to a docker container?

According to this comment, multi-line variables are supported with

docker compose

KEY: |-

However, when I execute
echo $KEY
in the container, it has replaced the newline with spaces:

line1 line2

Am I missing something? My docker version is 1.12.1.

Answer Source

The YAML syntax is correct. The shell command wasn't:

echo "$KEY"

prints the string with newlines.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download