Docker Compose

Compose variable interpolation

Substitute configuration values before service creation. A colon in default/required forms treats empty as absent. Double dollar prevents Compose substitution. Interpolation sources and runtime environment are separate; do not expose real values. Check the effective interpolation file and shell values before comparing rendered configuration with runtime environment.

Formal Syntax & Structure

docker syntaxdocker
${VAR:-default} / ${VAR:?message} / $$

Parameters & Attributes

NameTypeDescription
VARstringVariable name
defaultstringFallback text

Working Example

Example Snippetdocker
environment:  BM13_MODE: ${BM13_MODE:-safe}
Docker Reference