How to correctly multiline a Yaml List
This:
environment: key=value
is a mapping with one key environment
, which has as value key=value
. That is not further parsed, =
not having special meaning within YAML ( of course your application can further interpret such a scalar )
If you want list syntax in your block-style YAML, you'll need to use the block sequence entry indicator followed by a space (-
):
environment:
- key=value
again key=value
is a single scalar for YAML.
To set the environment variable DEBUG
, the docker-compose documentation uses:
web:
environment:
- DEBUG=1
The split into the environment variable name DEBUG
and its value (1
) is done by docker-compose. If you want an environment variable to have newlines, you'll need the complete sequence element to be a multiline scalar, which you can do in the following way:
environment:
- key=value
- key2=value2
- |-
publicKey=-----BEGIN PUBLIC KEY-----
UAdhusaudu89Ajdsdoskdosadk*(Sd98798da
kaosdkOKdoksaoKDOaksdo98d7868sadajidas