Merge pull request #84 from nVitius/var-interpolation-docs

Document Compose's syntax for variable defaults
This commit is contained in:
Victoria Bialas 2016-10-31 13:43:32 -07:00 committed by GitHub
commit 1676a8478d
1 changed files with 14 additions and 2 deletions

View File

@ -1143,8 +1143,20 @@ string. In the example above, if `EXTERNAL_PORT` is not set, the value for the
port mapping is `:5000` (which is of course an invalid port mapping, and will
result in an error when attempting to create the container).
Both `$VARIABLE` and `${VARIABLE}` syntax are supported. Extended shell-style
features, such as `${VARIABLE-default}` and `${VARIABLE/foo/bar}`, are not
In the case of environment variables that are not set, it is also possible to
define default values using one of the following syntax variants:
* To provide a default value that will be used if `VARIABLE` is either *unset* or *empty*:
`${VARIABLE:-default}`
* To provide a default value only if `VARIABLE` is *empty*:
`${VARIABLE-default}`
Both `$VARIABLE` and `${VARIABLE}` syntax are supported. Extended
shell-style features, such as `${VARIABLE/foo/bar}`, are not
supported.
You can use a `$$` (double-dollar sign) when your configuration needs a literal