You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The precedence documentation mentions "an environment file" (singular) but doesn't account for the scenario where Compose can load two .env files simultaneously - one from the working directory (PWD) and one from the project directory.
From the precedence list in envvars-precedence.md:
Set with either the environment or env_file attribute but with the value interpolated from your shell or an environment file. (either your default .env file, or with the --env-file argument in the CLI).
This mentions "your default .env file" without clarifying that there can be two .env files loaded.
Meanwhile, variable-interpolation.md documents this dual-file scenario in the section "local .env file versus .env file":
When executed without an explicit --env-file flag, Compose searches for an .env file in your working directory (PWD) and loads values both for self-configuration and interpolation. If the values in this file define the COMPOSE_FILE pre-defined variable, which results in a project directory being set to another folder, Compose will load a second .env file, if present. This second .env file has a lower precedence.
And the precedence list in variable-interpolation.md explicitly shows both:
If --env-file is not set, variables set by an .env file in local working directory (PWD)
Variables from a file set by --env-file or an .env file in project directory
Why this matters
A reader following the precedence documentation in envvars-precedence.md would not know that Compose can load two .env files and how they interact with each other. This creates an incomplete mental model of how environment variable precedence works.
When a user encounters the dual .env file scenario (PWD vs project directory), they won't find guidance in the precedence documentation about which file takes precedence.
Suggested fix
Update the precedence documentation in envvars-precedence.md to acknowledge that there can be two .env files (PWD and project directory) and clarify their relative precedence. Either:
Add a note after the precedence list explaining the dual .env file scenario and linking to the detailed explanation in variable-interpolation.md
Example addition:
Note: When Compose loads an .env file from your working directory that sets COMPOSE_FILE to a different location, Compose may load a second .env file from the project directory. In this case, the working directory .env file has higher precedence than the project directory .env file. See local .env file versus project directory .env file for details.
File:
content/manuals/compose/how-tos/environment-variables/envvars-precedence.mdIssue
The precedence documentation mentions "an environment file" (singular) but doesn't account for the scenario where Compose can load two
.envfiles simultaneously - one from the working directory (PWD) and one from the project directory.From the precedence list in
envvars-precedence.md:This mentions "your default
.envfile" without clarifying that there can be two.envfiles loaded.Meanwhile,
variable-interpolation.mddocuments this dual-file scenario in the section "local.envfile versus.envfile":And the precedence list in
variable-interpolation.mdexplicitly shows both:Why this matters
A reader following the precedence documentation in
envvars-precedence.mdwould not know that Compose can load two.envfiles and how they interact with each other. This creates an incomplete mental model of how environment variable precedence works.When a user encounters the dual
.envfile scenario (PWD vs project directory), they won't find guidance in the precedence documentation about which file takes precedence.Suggested fix
Update the precedence documentation in
envvars-precedence.mdto acknowledge that there can be two.envfiles (PWD and project directory) and clarify their relative precedence. Either:.envfiles and their order, or.envfile scenario and linking to the detailed explanation invariable-interpolation.mdExample addition:
Found by nightly documentation quality scanner