1
2
3
4
5
6
7
8
9
10
|
<h1>Compose CLI environment variables</h1>
<p>Several environment variables are available for you to configure the Docker Compose command-line behaviour.</p> <p>Variables starting with <code class="language-plaintext highlighter-rouge">DOCKER_</code> are the same as those used to configure the Docker command-line client. If you’re using <code class="language-plaintext highlighter-rouge">docker-machine</code>, then the <code class="language-plaintext highlighter-rouge">eval "$(docker-machine env my-docker-vm)"</code> command should set them to their correct values. (In this example, <code class="language-plaintext highlighter-rouge">my-docker-vm</code> is the name of a machine you created.)</p> <blockquote> <p><strong>Note</strong>: Some of these variables can also be provided using an <a href="../../env-file/index">environment file</a>.</p> </blockquote> <h2 id="compose_project_name">COMPOSE_PROJECT_NAME</h2> <p>Sets the project name. This value is prepended along with the service name to the container on start up. For example, if your project name is <code class="language-plaintext highlighter-rouge">myapp</code> and it includes two services <code class="language-plaintext highlighter-rouge">db</code> and <code class="language-plaintext highlighter-rouge">web</code>, then Compose starts containers named <code class="language-plaintext highlighter-rouge">myapp-db-1</code> and <code class="language-plaintext highlighter-rouge">myapp-web-1</code> respectively.</p> <p>Setting this is optional. If you do not set this, the <code class="language-plaintext highlighter-rouge">COMPOSE_PROJECT_NAME</code> defaults to the <code class="language-plaintext highlighter-rouge">basename</code> of the project directory. See also the <code class="language-plaintext highlighter-rouge">-p</code> <a href="../index">command-line option</a>.</p> <h2 id="compose_file">COMPOSE_FILE</h2> <p>Specify the path to a Compose file. If not provided, Compose looks for a file named <code class="language-plaintext highlighter-rouge">docker-compose.yml</code> in the current directory and then each parent directory in succession until a file by that name is found.</p> <p>This variable supports multiple Compose files separated by a path separator (on Linux and macOS the path separator is <code class="language-plaintext highlighter-rouge">:</code>, on Windows it is <code class="language-plaintext highlighter-rouge">;</code>). For example: <code class="language-plaintext highlighter-rouge">COMPOSE_FILE=docker-compose.yml:docker-compose.prod.yml</code>. The path separator can also be customized using <code class="language-plaintext highlighter-rouge">COMPOSE_PATH_SEPARATOR</code>.</p> <p>See also the <code class="language-plaintext highlighter-rouge">-f</code> <a href="../index">command-line option</a>.</p> <h2 id="compose_profiles">COMPOSE_PROFILES</h2> <p>Specify one or multiple active profiles to enable. Calling <code class="language-plaintext highlighter-rouge">docker-compose up</code> with <code class="language-plaintext highlighter-rouge">COMPOSE_PROFILES=frontend</code> will start the services with the profile <code class="language-plaintext highlighter-rouge">frontend</code> and services without specified profiles.</p> <p>You can specify a list of profiles separated with a comma: <code class="language-plaintext highlighter-rouge">COMPOSE_PROFILES=frontend,debug</code> will enable the profiles <code class="language-plaintext highlighter-rouge">frontend</code> and <code class="language-plaintext highlighter-rouge">debug</code>.</p> <p>See also <a href="../../profiles/index"><em>Using profiles with Compose</em></a> and the <code class="language-plaintext highlighter-rouge">--profile</code> <a href="../index#use---profile-to-specify-one-or-more-active-profiles">command-line option</a>.</p> <h2 id="compose_api_version">COMPOSE_API_VERSION</h2> <p>The Docker API only supports requests from clients which report a specific version. If you receive a <code class="language-plaintext highlighter-rouge">client and server don't have same version</code> error using <code class="language-plaintext highlighter-rouge">docker-compose</code>, you can workaround this error by setting this environment variable. Set the version value to match the server version.</p> <p>Setting this variable is intended as a workaround for situations where you need to run temporarily with a mismatch between the client and server version. For example, if you can upgrade the client but need to wait to upgrade the server.</p> <p>Running with this variable set and a known mismatch does prevent some Docker features from working properly. The exact features that fail would depend on the Docker client and server versions. For this reason, running with this variable set is only intended as a workaround and it is not officially supported.</p> <p>If you run into problems running with this set, resolve the mismatch through upgrade and remove this setting to see if your problems resolve before notifying support.</p> <h2 id="docker_host">DOCKER_HOST</h2> <p>Sets the URL of the <code class="language-plaintext highlighter-rouge">docker</code> daemon. As with the Docker client, defaults to <code class="language-plaintext highlighter-rouge">unix:///var/run/docker.sock</code>.</p> <h2 id="docker_tls_verify">DOCKER_TLS_VERIFY</h2> <p>When set to anything other than an empty string, enables TLS communication with the <code class="language-plaintext highlighter-rouge">docker</code> daemon.</p> <h2 id="docker_cert_path">DOCKER_CERT_PATH</h2> <p>Configures the path to the <code class="language-plaintext highlighter-rouge">ca.pem</code>, <code class="language-plaintext highlighter-rouge">cert.pem</code>, and <code class="language-plaintext highlighter-rouge">key.pem</code> files used for TLS verification. Defaults to <code class="language-plaintext highlighter-rouge">~/.docker</code>.</p> <h2 id="compose_http_timeout">COMPOSE_HTTP_TIMEOUT</h2> <p>Configures the time (in seconds) a request to the Docker daemon is allowed to hang before Compose considers it failed. Defaults to 60 seconds.</p> <h2 id="compose_tls_version">COMPOSE_TLS_VERSION</h2> <p>Configure which TLS version is used for TLS communication with the <code class="language-plaintext highlighter-rouge">docker</code> daemon. Defaults to <code class="language-plaintext highlighter-rouge">TLSv1</code>. Supported values are: <code class="language-plaintext highlighter-rouge">TLSv1</code>, <code class="language-plaintext highlighter-rouge">TLSv1_1</code>, <code class="language-plaintext highlighter-rouge">TLSv1_2</code>.</p> <h2 id="compose_convert_windows_paths">COMPOSE_CONVERT_WINDOWS_PATHS</h2> <p>Enable path conversion from Windows-style to Unix-style in volume definitions. Users of Docker Machine on Windows should always set this. Defaults to <code class="language-plaintext highlighter-rouge">0</code>. Supported values: <code class="language-plaintext highlighter-rouge">true</code> or <code class="language-plaintext highlighter-rouge">1</code> to enable, <code class="language-plaintext highlighter-rouge">false</code> or <code class="language-plaintext highlighter-rouge">0</code> to disable.</p> <h2 id="compose_path_separator">COMPOSE_PATH_SEPARATOR</h2> <p>If set, the value of the <code class="language-plaintext highlighter-rouge">COMPOSE_FILE</code> environment variable is separated using this character as path separator.</p> <h2 id="compose_force_windows_host">COMPOSE_FORCE_WINDOWS_HOST</h2> <p>If set, volume declarations using the <a href="../../compose-file/compose-file-v3/index#short-syntax-3">short syntax</a> are parsed assuming the host path is a Windows path, even if Compose is running on a UNIX-based system. Supported values: <code class="language-plaintext highlighter-rouge">true</code> or <code class="language-plaintext highlighter-rouge">1</code> to enable, <code class="language-plaintext highlighter-rouge">false</code> or <code class="language-plaintext highlighter-rouge">0</code> to disable.</p> <h2 id="compose_ignore_orphans">COMPOSE_IGNORE_ORPHANS</h2> <p>If set, Compose doesn’t try to detect orphaned containers for the project. Supported values: <code class="language-plaintext highlighter-rouge">true</code> or <code class="language-plaintext highlighter-rouge">1</code> to enable, <code class="language-plaintext highlighter-rouge">false</code> or <code class="language-plaintext highlighter-rouge">0</code> to disable.</p> <h2 id="compose_parallel_limit">COMPOSE_PARALLEL_LIMIT</h2> <p>Sets a limit for the number of operations Compose can execute in parallel. The default value is <code class="language-plaintext highlighter-rouge">64</code>, and may not be set lower than <code class="language-plaintext highlighter-rouge">2</code>.</p> <h2 id="compose_interactive_no_cli">COMPOSE_INTERACTIVE_NO_CLI</h2> <p>If set, Compose doesn’t attempt to use the Docker CLI for interactive <code class="language-plaintext highlighter-rouge">run</code> and <code class="language-plaintext highlighter-rouge">exec</code> operations. This option is not available on Windows where the CLI is required for the aforementioned operations. Supported: <code class="language-plaintext highlighter-rouge">true</code> or <code class="language-plaintext highlighter-rouge">1</code> to enable, <code class="language-plaintext highlighter-rouge">false</code> or <code class="language-plaintext highlighter-rouge">0</code> to disable.</p> <h2 id="compose_docker_cli_build">COMPOSE_DOCKER_CLI_BUILD</h2> <p>Configure whether to use the Compose python client for building images or the native docker cli. By default, Compose uses the <code class="language-plaintext highlighter-rouge">docker</code> CLI to perform builds, which allows you to use <a href="https://docs.docker.com/develop/develop-images/build_enhancements/#to-enable-buildkit-builds">BuildKit</a> to perform builds.</p> <p>Set <code class="language-plaintext highlighter-rouge">COMPOSE_DOCKER_CLI_BUILD=0</code> to disable native builds, and to use the built-in python client.</p> <h2 id="related-information">Related information</h2> <ul> <li><a href="../../index">User guide</a></li> <li><a href="../../install/index">Installing Compose</a></li> <li><a href="../../compose-file/index">Compose file reference</a></li> <li><a href="../../env-file/index">Environment file</a></li> </ul>
<p><a href="https://docs.docker.com/search/?q=fig">fig</a>, <a href="https://docs.docker.com/search/?q=composition">composition</a>, <a href="https://docs.docker.com/search/?q=compose">compose</a>, <a href="https://docs.docker.com/search/?q=docker">docker</a>, <a href="https://docs.docker.com/search/?q=orchestration">orchestration</a>, <a href="https://docs.docker.com/search/?q=cli">cli</a>, <a href="https://docs.docker.com/search/?q=reference">reference</a></p>
<div class="_attribution">
<p class="_attribution-p">
© 2019 Docker, Inc.<br>Licensed under the Apache License, Version 2.0.<br>Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.<br>Docker, Inc. and other parties may also have trademark rights in other terms used herein.<br>
<a href="https://docs.docker.com/compose/reference/envvars/" class="_attribution-link">https://docs.docker.com/compose/reference/envvars/</a>
</p>
</div>
|