mirror of https://github.com/docker/docs.git
Merge pull request #12142 from ndeloof/dotEnv
clarification on .env file lookup vs project-directory
This commit is contained in:
commit
7cda3c8fc6
|
@ -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
|
||||
>
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue