content/manuals/compose/how-tos/environment-variables/envvars.md
Docker Compose includes several pre-defined environment variables. It also inherits common Docker CLI environment variables, such as DOCKER_HOST and DOCKER_CONTEXT. See Docker CLI environment variable reference for details.
This page explains how to set or change the following pre-defined environment variables:
COMPOSE_PROJECT_NAMECOMPOSE_FILECOMPOSE_PROFILESCOMPOSE_CONVERT_WINDOWS_PATHSCOMPOSE_PATH_SEPARATORCOMPOSE_IGNORE_ORPHANSCOMPOSE_REMOVE_ORPHANSCOMPOSE_PARALLEL_LIMITCOMPOSE_ANSICOMPOSE_STATUS_STDOUTCOMPOSE_ENV_FILESCOMPOSE_DISABLE_ENV_FILECOMPOSE_MENUCOMPOSE_EXPERIMENTALCOMPOSE_PROGRESS| Method | Description |
|---|---|
.env file | Located in the working directory. |
| Shell | Defined in the host operating system shell. |
| CLI | Passed with --env or -e flag at runtime. |
When changing or setting any environment variables, be aware of Environment variable precedence.
Sets the project name. This value is prepended along with the service name to 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 can set the project name in different ways. The level of precedence (from highest to lowest) for each method is as follows:
-p command line flagCOMPOSE_PROJECT_NAMEname: variable from the config file (or the last name: from
a series of config files specified using -f)basename of the project directory containing the config file (or
containing the first config file specified using -f)basename of the current directory if no config file is specifiedProject names must contain only lowercase letters, decimal digits, dashes, and
underscores, and must begin with a lowercase letter or decimal digit. If the
basename of the project directory or current directory violates this
constraint, you must use one of the other mechanisms.
See also using -p to specify a project name.
Specifies the path to a Compose file. Specifying multiple Compose files is supported.
compose.yaml in the current directory and, if not found, then Compose searches each parent directory recursively until a file by that name is found.Mac and Linux: : (colon)
Windows: ; (semicolon)
For example:
COMPOSE_FILE=compose.yaml:compose.prod.yaml
COMPOSE_PATH_SEPARATOR.See also using -f to specify name and path of one or more Compose files.
Specifies one or more profiles to be enabled when docker compose up is run.
Services with matching profiles are started as well as any services for which no profile has been defined.
For example, calling docker compose up with COMPOSE_PROFILES=frontend selects services with the
frontend profile as well as any services without a profile specified.
If specifying multiple profiles, use a comma as a separator.
The following example enables all services matching both the frontend and debug profiles and services without a profile.
COMPOSE_PROFILES=frontend,debug
See also Using profiles with Compose and the --profile command-line option.
Specifies a different path separator for items listed in COMPOSE_FILE.
:;Specifies which environment files Compose should use if --env-file isn't used.
When using multiple environment files, use a comma as a separator. For example:
COMPOSE_ENV_FILES=.env.envfile1,.env.envfile2
If COMPOSE_ENV_FILES is not set, and you don't provide --env-file in the CLI, Docker Compose uses the default behavior, which is to look for an .env file in the project directory.
Lets you disable the use of the default .env file.
true or 1, Compose ignores the .env filefalse or 0, Compose looks for an .env file in the project directory0When enabled, Compose performs path conversion from Windows-style to Unix-style in volume definitions.
true or 1, to enablefalse or 0, to disable0When enabled, Compose doesn't try to detect orphaned containers for the project.
true or 1, to enablefalse or 0, to disable0When enabled, Compose automatically removes orphaned containers when updating a service or stack. Orphaned containers are those that were created by a previous configuration but are no longer defined in the current compose.yaml file.
true or 1, to enable automatic removal of orphaned containersfalse or 0, to disable automatic removal. Compose displays a warning about orphaned containers instead.0Specifies the maximum level of parallelism for concurrent engine calls.
Specifies when to print ANSI control characters.
auto, Compose detects if TTY mode can be used. Otherwise, use plain text modenever, use plain text modealways or 0, use TTY modeautoWhen enabled, Compose writes its internal status and progress messages to stdout instead of stderr.
The default value is false to clearly separate the output streams between Compose messages and your container's logs.
true or 1, to enablefalse or 0, to disable0{{< summary-bar feature_name="Compose progress" >}}
Defines the type of progress output, if --progress isn't used.
Supported values are auto, tty, plain, json, and quiet.
Default is auto.
{{< summary-bar feature_name="Compose menu" >}}
When enabled, Compose displays a navigation menu where you can choose to open the Compose stack in Docker Desktop, switch on watch mode, or use Docker Debug.
true or 1, to enablefalse or 0, to disable1 if you obtained Docker Compose through Docker Desktop, otherwise the default is 0{{< summary-bar feature_name="Compose experimental" >}}
This is an opt-out variable. When turned off it deactivates the experimental features.
true or 1, to enablefalse or 0, to disable1The following environment variables have no effect in Compose V2.
COMPOSE_API_VERSION
By default the API version is negotiated with the server. Use DOCKER_API_VERSION.COMPOSE_HTTP_TIMEOUTCOMPOSE_TLS_VERSIONCOMPOSE_FORCE_WINDOWS_HOSTCOMPOSE_INTERACTIVE_NO_CLICOMPOSE_DOCKER_CLI_BUILD
Use DOCKER_BUILDKIT to select between BuildKit and the classic builder. If DOCKER_BUILDKIT=0 then docker compose build uses the classic builder to build images.