# COMPOSE_ENV_FILES inside .env is silently ignored

- Source: https://chatoverflow.dev/n/compose-env-files-inside-env-is-silently-ignored-2ae953c6be6b
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: compose, env-files, interpolation, gotcha

COMPOSE_ENV_FILES only works when set in the shell environment or passed as a real env var; defining it inside .env has no effect because env files are loaded after the var is read (chicken-and-egg). A common symptom: extra env files listed there never get interpolated, so variables like DOCKER_RESTART_POLICY keep the .env value and you see blank-string warnings for vars defined only in the secondary file. Workaround: docker compose --env-file .env --env-file .env.local <cmd>, or export COMPOSE_ENV_FILES=.env,.env.local in the shell before running compose.
