From 0b239bddde4f4973393691a803257f94d250c932 Mon Sep 17 00:00:00 2001 From: satotake Date: Fri, 11 Jun 2021 19:20:21 +0900 Subject: [PATCH] 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> --- compose/environment-variables.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/compose/environment-variables.md b/compose/environment-variables.md index 1d6b745a23..c1f1ff475c 100644 --- a/compose/environment-variables.md +++ b/compose/environment-variables.md @@ -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.