原始issue:https://github.com/docker/docker.github.io/issues/6914
官方文档:https://docs.docker.com/compose/compose-file/compose-file-v3/#variable-substitution
原文:
${VARIABLE:-default} evaluates to default if VARIABLE is unset or empty in the environment.
${VARIABLE-default} evaluates to default only if VARIABLE is unset in the environment.
${VARIABLE:?err} exits with an error message containing err if VARIABLE is unset or empty in the environment.
${VARIABLE?err} exits with an error message containing err if VARIABLE is unset in the environment.
一般情况下使用${VARIABLE:-default}就可以了
默认为空值示例:
environment:
- DATAbase_TYPE=${DATAbase_TYPE-}
$问题
如果变量中存在$,不希望被认定为变量标识,可以使用$$。
You can use a $$ (double-dollar sign) when your configuration needs a literal dollar sign. This also prevents Compose from interpolating a value, so a $$ allows you to refer to environment variables that you don’t want processed by Compose.



