PureDevTools

Docker Compose Env Substitutor

Preview env var substitution in docker-compose.yml — see resolved values before deploying, nothing sent to any server

All processing happens in your browser. No data is sent to any server.

Paste your docker-compose.yml and .env file above to preview how your compose file looks after environment variable substitution. Supports ${VAR}, ${VAR:-default}, ${VAR:+alt}, ${VAR?error}, and $VAR patterns.

Docker Compose files use ${VARIABLE} syntax for environment variable substitution, but you can’t see the resolved values until runtime. If a variable is missing, Compose silently uses an empty string — or your default value might have a syntax error. This tool lets you paste your compose file and your .env values, then shows you the fully resolved output before you deploy.

Why Preview Substitution

Environment variable issues are among the hardest Docker Compose bugs to debug:

This tool resolves all ${} references and highlights unresolved variables so you catch issues before deployment.

Substitution Syntax

Docker Compose supports these variable substitution patterns:

SyntaxBehavior
${VAR}Value of VAR, empty if unset
${VAR:-default}Value of VAR, or default if unset or empty
${VAR-default}Value of VAR, or default if unset (empty is kept)
${VAR:?error}Value of VAR, or error if unset or empty
${VAR?error}Value of VAR, or error if unset

How to Use

  1. Paste your docker-compose.yml in the left panel
  2. Add your environment variables (KEY=VALUE format) in the right panel
  3. The tool resolves all ${} references and shows the final output
  4. Unresolved variables are highlighted in the output

Example

Input compose file:

services:
  app:
    image: myapp:${APP_VERSION:-latest}
    ports:
      - "${HOST_PORT:-3000}:3000"
    environment:
      - DATABASE_URL=postgres://${DB_USER}:${DB_PASS}@db:5432/${DB_NAME}

With variables:

APP_VERSION=2.1.0
HOST_PORT=8080
DB_USER=admin
DB_PASS=secret123
DB_NAME=production

The resolved output shows every ${} replaced with its actual value, making it easy to verify your configuration before deployment.

Frequently Asked Questions

Does it support the .env file format? Yes. Paste your .env file contents (one KEY=VALUE per line) into the variables panel. Comments (lines starting with #) and empty lines are ignored.

What happens with undefined variables? Undefined variables without defaults resolve to empty strings, matching Docker Compose’s actual behavior. They’re highlighted in the output so you can spot them.

Does it handle variable substitution inside environment blocks? Yes. Variables are resolved everywhere in the compose file — service names, image tags, port mappings, volume paths, environment values, and labels.

Is my configuration sent to a server? No. All substitution happens in your browser. Your environment variables and compose configuration never leave your device.

Related Tools

More Docker & DevOps Tools