Merge pull request #12142 from ndeloof/dotEnv

clarification on .env file lookup vs project-directory
This commit is contained in:
Usha Mandya 2021-01-20 18:34:12 +00:00 committed by GitHub
commit 7cda3c8fc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -18,8 +18,9 @@ string. In the example above, if `POSTGRES_VERSION` is not set, the value for
the `image` option is `postgres:`.
You can set default values for environment variables using a
[`.env` file](/compose/env-file/), which Compose automatically looks for. Values
set in the shell environment override those set in the `.env` file.
[`.env` file](/compose/env-file/), which Compose automatically looks for in
project directory (parent folder of your Compose file).
Values set in the shell environment override those set in the `.env` file.
> Note when using docker stack deploy
>

View File

@ -23,7 +23,9 @@ web:
If you have multiple environment variables, you can substitute them by providing
a path to your environment variables file. By default, the `docker-compose`
command will look for a file named `.env` in the directory you run the command.
command will look for a file named `.env` in the project directory (parent folder
of your Compose file).
By passing the file as an argument, you can store it anywhere and name it
appropriately, for example, `.env.ci`, `.env.dev`, `.env.prod`. Passing the file path is
done using the `--env-file` option: