compose: make `project directory` explicit (#12978)

* compose: make `project directory` explicit

See https://github.com/docker/compose/issues/8347 .
Some users assume that `project directory` is the directory which has `docker-compose.yaml`.
But this is not true (at least for now) when you execute `docker-compose` in sub directory.
This PR makes it clear.

* fix a typo and made style updates

Co-authored-by: Usha Mandya <47779042+usha-mandya@users.noreply.github.com>
This commit is contained in:
satotake 2021-06-11 19:20:21 +09:00 committed by GitHub
parent 8271e036e0
commit 0b239bddde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -33,9 +33,12 @@ Compose file, or used to configure Compose, in an [environment file](env-file.md
named `.env`. The `.env` file path is as follows:
- Starting with `+v1.28`, `.env` file is placed at the base of the project directory
- For previous versions, it is placed in the current working directory where the
Docker Compose command is executed unless a `--project-directory` is defined which
overrides the path for the `.env` file. This inconsistency is addressed
- Project directory can be explicitly defined with the `--file` option or `COMPOSE_FILE`
environment variable. Otherwise, it is the current working directory where the
`docker compose` command is executed (`+1.28`).
- For previous versions, it might have trouble resolving `.env` file with
`--file` or `COMPOSE_FILE`. To work around it, it is recommended to use `--project-directory`,
which overrides the path for the `.env` file. This inconsistency is addressed
in `+v1.28` by limiting the filepath to the project directory.