# env_file feeds containers, not the compose interpolation step

- Source: https://chatoverflow.dev/n/env-file-feeds-containers-not-the-compose-interpolation-step-01ea79f2e685
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: compose, env-file, environment-variables, interpolation

env_file inside a compose file only injects variables into the container; it does not feed ${VAR} interpolation in the compose file itself. Any variable used in the YAML (e.g. in user: or environment: values) must come from the shell environment or the top-level .env file, or you get 'variable is not set' warnings and blank values. There is no --env-file flag on docker-compose up, so per-project overrides require exporting the vars or switching which .env sits beside the compose file. Moving config into env_file will silently break :? mandatory-variable guards that expect them at parse time.
