Docker Compose Environment Variable Resolver
Preview Compose interpolation with shell precedence, operator semantics, missing values, and masked secret-aware output.
Paste a Compose file containing $VAR, ${VAR}, fallback, required, or alternative expressions.
In shell-override mode these values take precedence over the pasted .env block, matching Compose interpolation precedence.
Resolution settings
Report controls
Values stay in this browser session. No local .env file is read automatically, and nothing here starts Docker or inspects a running container.
Interpolation happens before the container gets its environment
Compose interpolation replaces variables in the Compose model. That is a different question from which value finally appears inside a container through environment, env_file, image ENV, or docker compose run -e. A value can win interpolation precedence without being a container environment variable by itself.
For interpolation, shell values take precedence over an environment file. Docker exposes the environment used for interpolation through docker compose config --environment; that command remains the authoritative check for a real project with its actual files and CLI flags.
Colon changes empty-string behavior
${VAR:-fallback} uses the fallback when VAR is unset or empty.
${VAR-fallback} uses it only when VAR is unset.
${VAR:?message} fails for unset or empty values; ${VAR?message} fails only when unset.
:+ and + use the same empty-versus-unset distinction for alternative values.
Preview modes can intentionally differ from Compose
“Keep placeholder”, visible missing markers, report-only fallbacks, and ignored fallbacks are review aids. Normal Compose behavior substitutes an unset plain variable with an empty string and applies supported operators. Do not copy an analysis-mode preview into production and assume Docker produced it.
What is parsed from the pasted .env block
The parser accepts = or : delimiters, ignores blank/comment lines, keeps # inside unquoted values unless whitespace starts a comment, decodes common escapes inside double quotes, and keeps single-quoted values literal. Single-quoted values may span lines. Duplicate names are reported and the later pasted definition wins inside that source.
Unquoted and double-quoted .env values can themselves contain Compose-style interpolation. Single quotes deliberately prevent it. These details matter when a seemingly simple .env value contains another variable, a literal dollar sign, or an inline comment.
Boundaries worth keeping visible
$$emits a literal dollar sign and suppresses Compose interpolation for that dollar.- Interpolation applies to values, not YAML mapping keys. Compose commonly uses an equal-sign list form when a key itself needs interpolation.
- Multiple
--env-filearguments, project-directory discovery,COMPOSE_FILErelocation, and host process state are not inferred from pasted text. env_file:under a service controls the container environment and is not the same thing as the .env file used to interpolate the Compose model.- Swarm
docker stack deploydoes not provide the same .env substitution feature as Docker Compose CLI.
Keep secrets out of copied previews
Secret-looking names are masked in generated output by default. That reduces accidental exposure in tickets and screenshots, but name matching cannot identify every credential. Docker also recommends using secrets rather than ordinary environment variables for sensitive material when the platform supports that design.
Docker references behind these rules
Docker documents interpolation syntax and .env parsing in its environment-variable guide, and separately documents container environment precedence. Those are intentionally separate concepts here too.
