Docker · tool · fg-0268
Variables from the Compose project dotenv file are substituted into the YAML but missing inside the container
printenv inside the container does not list the variable
Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100
Cause
Compose reads the dotenv file in the project directory only to fill ${VAR} references in the Compose file, and --env-file only changes which file feeds that substitution. Nothing reaches a container unless a service lists it under environment or env_file.
Fix
Reference each variable under environment, or point the service at the file with env_file.
Apply
services:
api:
env_file: app.env
environment:
DATABASE_URL: ${DATABASE_URL}Affects: Docker Compose v2, as of October 2026
Sources
Have your agent know this before it fails
claude mcp add --transport http footgun https://getfootgun.com/api/mcp