mirror of https://github.com/docker/docs.git
parent
326cb37213
commit
8be114620e
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue