Merge pull request #11287 from DavidTheProgrammer/patch-1

Added documentation for docker-compose --env-file option to compose/environment-variables.md
This commit is contained in:
Usha Mandya 2020-08-26 16:43:48 +01:00 committed by GitHub
commit 9df2ab4aaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -18,6 +18,17 @@ web:
image: "webapp:${TAG}"
```
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.
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:
```shell
docker-compose --env-file ./config/.env.dev up
```
For more information, see the
[Variable substitution](compose-file/index.md#variable-substitution) section in the
Compose file reference.