diff --git a/compose/environment-variables/envvars.md b/compose/environment-variables/envvars.md index 77b687eeeb..23c22cffad 100644 --- a/compose/environment-variables/envvars.md +++ b/compose/environment-variables/envvars.md @@ -43,16 +43,15 @@ the container's name on startup. For example, if your project name is `myapp` and it includes two services `db` and `web`, then Compose starts containers named `myapp-db-1` and `myapp-web-1` respectively. -Compose sets the project name using the following mechanisms, in order of -precedence: +Compose can set the project name in different ways. The level of precedence (from highest to lowest) for each method is as follows: -- The `-p` command line flag -- `COMPOSE_PROJECT_NAME` -- The top level `name:` variable from the config file (or the last `name:` from +1. The `-p` command line flag +2. `COMPOSE_PROJECT_NAME` +3. The top level `name:` variable from the config file (or the last `name:` from a series of config files specified using `-f`) -- The `basename` of the project directory containing the config file (or +4. The `basename` of the project directory containing the config file (or containing the first config file specified using `-f`) -- The `basename` of the current directory if no config file is specified +5. The `basename` of the current directory if no config file is specified Project names must contain only lowercase letters, decimal digits, dashes, and underscores, and must begin with a lowercase letter or decimal digit. If the diff --git a/compose/reference/index.md b/compose/reference/index.md index 8d97b012e7..27397b2bc1 100644 --- a/compose/reference/index.md +++ b/compose/reference/index.md @@ -185,16 +185,15 @@ Status: Downloaded newer image for postgres:latest ## Use `-p` to specify a project name -Each configuration has a project name. Compose sets the project name using the -following mechanisms, in order of precedence: +Each configuration has a project name which Compose can set in different ways. The level of precedence (from highest to lowest) for each method is as follows: -- The `-p` command line flag -- The [COMPOSE_PROJECT_NAME environment variable][] -- The top level `name:` variable from the config file (or the last `name:` from +1. The `-p` command line flag +2. The [COMPOSE_PROJECT_NAME environment variable][] +3. The top level `name:` variable from the config file (or the last `name:` from a series of config files specified using `-f`) -- The `basename` of the project directory containing the config file (or +4. The `basename` of the project directory containing the config file (or containing the first config file specified using `-f`) -- The `basename` of the current directory if no config file is specified +5. The `basename` of the current directory if no config file is specified [COMPOSE_PROJECT_NAME environment variable]: ../environment-variables/envvars.md#compose_project_name