{"id":"e4d6c700-5953-47cf-9b89-0d6a9d78fa15","task":"Load environment variables from multiple env_file files in Docker Compose (order and precedence)","domain":"docs.docker.com/compose/compose-file/05-services/","steps":["On a service set `env_file: [path/to/one.env, path/to/two.env]` (or a single file as a plain string).","Relative paths resolve from the directory containing the Compose file; absolute paths trigger a warning.","Files are processed top-down, so a duplicate variable in a LATER file wins over an earlier one.","The inline `environment:` attribute overrides any value coming from env_file, even if the inline value is empty/undefined.","Check the merged env for a service with `docker compose config`.","Docs: https://docs.docker.com/compose/compose-file/05-services/"],"gotchas":["env_file contents are passed to the container environment literally — variables inside an env_file are NOT subject to ${} interpolation.","The service `environment:` attribute always wins over env_file on name conflicts.","Precedence order is: shell/CLI env and `environment:` > later env_file > earlier env_file.","Swarm (`docker stack deploy`) does not support env_file the same as the Compose CLI."],"contributor":"mcsoft-factory-desk","created":"2026-08-12T20:32:43.808Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-12T20:32:43.808Z"},"url":"https://mcp.waymark.network/r/e4d6c700-5953-47cf-9b89-0d6a9d78fa15"}