diff options
Diffstat (limited to 'devdocs/docker/compose%2Freference%2Findex.html')
| -rw-r--r-- | devdocs/docker/compose%2Freference%2Findex.html | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/devdocs/docker/compose%2Freference%2Findex.html b/devdocs/docker/compose%2Freference%2Findex.html new file mode 100644 index 00000000..54605d8a --- /dev/null +++ b/devdocs/docker/compose%2Freference%2Findex.html @@ -0,0 +1,96 @@ +<h1>Overview of docker-compose CLI</h1> + +<p>This page provides the usage information for the <code class="language-plaintext highlighter-rouge">docker-compose</code> Command.</p> <h2 id="command-options-overview-and-help">Command options overview and help</h2> <p>You can also see this information by running <code class="language-plaintext highlighter-rouge">docker-compose --help</code> from the command line.</p> <pre data-language="">Define and run multi-container applications with Docker. + +Usage: + docker-compose [-f <arg>...] [--profile <name>...] [options] [COMMAND] [ARGS...] + docker-compose -h|--help + +Options: + -f, --file FILE Specify an alternate compose file + (default: docker-compose.yml) + -p, --project-name NAME Specify an alternate project name + (default: directory name) + --profile NAME Specify a profile to enable + --verbose Show more output + --log-level LEVEL DEPRECATED and not working from 2.0 - Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL) + --no-ansi Do not print ANSI control characters + -v, --version Print version and exit + -H, --host HOST Daemon socket to connect to + + --tls Use TLS; implied by --tlsverify + --tlscacert CA_PATH Trust certs signed only by this CA + --tlscert CLIENT_CERT_PATH Path to TLS certificate file + --tlskey TLS_KEY_PATH Path to TLS key file + --tlsverify Use TLS and verify the remote + --skip-hostname-check Don't check the daemon's hostname against the + name specified in the client certificate + --project-directory PATH Specify an alternate working directory + (default: the path of the Compose file) + --compatibility If set, Compose will attempt to convert deploy + keys in v3 files to their non-Swarm equivalent + +Commands: + build Build or rebuild services + bundle Generate a Docker bundle from the Compose file + config Validate and view the Compose file + create Create services + down Stop and remove containers, networks, images, and volumes + events Receive real time events from containers + exec Execute a command in a running container + help Get help on a command + images List images + kill Kill containers + logs View output from containers + pause Pause services + port Print the public port for a port binding + ps List containers + pull Pull service images + push Push service images + restart Restart services + rm Remove stopped containers + run Run a one-off command + scale Set number of containers for a service + start Start services + stop Stop services + top Display the running processes + unpause Unpause services + up Create and start containers + version Show the Docker-Compose version information +</pre> <p>You can use Docker Compose binary, <code class="language-plaintext highlighter-rouge">docker-compose [-f <arg>...] [options] [COMMAND] [ARGS...]</code>, to build and manage multiple services in Docker containers.</p> <h2 id="use--f-to-specify-name-and-path-of-one-or-more-compose-files">Use <code class="language-plaintext highlighter-rouge">-f</code> to specify name and path of one or more Compose files</h2> <p>Use the <code class="language-plaintext highlighter-rouge">-f</code> flag to specify the location of a Compose configuration file.</p> <h3 id="specifying-multiple-compose-files">Specifying multiple Compose files</h3> <p>You can supply multiple <code class="language-plaintext highlighter-rouge">-f</code> configuration files. When you supply multiple files, Compose combines them into a single configuration. Compose builds the configuration in the order you supply the files. Subsequent files override and add to their predecessors.</p> <p>For example, consider this command line:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker-compose -f docker-compose.yml -f docker-compose.admin.yml run backup_db +</pre></div> <p>The <code class="language-plaintext highlighter-rouge">docker-compose.yml</code> file might specify a <code class="language-plaintext highlighter-rouge">webapp</code> service.</p> <div class="highlight"><pre class="highlight" data-language="">webapp: + image: examples/web + ports: + - "8000:8000" + volumes: + - "/data" +</pre></div> <p>If the <code class="language-plaintext highlighter-rouge">docker-compose.admin.yml</code> also specifies this same service, any matching fields override the previous file. New values, add to the <code class="language-plaintext highlighter-rouge">webapp</code> service configuration.</p> <div class="highlight"><pre class="highlight" data-language="">webapp: + build: . + environment: + - DEBUG=1 +</pre></div> <p>When you use multiple Compose files, all paths in the files are relative to the first configuration file specified with <code class="language-plaintext highlighter-rouge">-f</code>. You can use the <code class="language-plaintext highlighter-rouge">--project-directory</code> option to override this base path.</p> <p>Use a <code class="language-plaintext highlighter-rouge">-f</code> with <code class="language-plaintext highlighter-rouge">-</code> (dash) as the filename to read the configuration from <code class="language-plaintext highlighter-rouge">stdin</code>. When <code class="language-plaintext highlighter-rouge">stdin</code> is used all paths in the configuration are relative to the current working directory.</p> <p>The <code class="language-plaintext highlighter-rouge">-f</code> flag is optional. If you don’t provide this flag on the command line, Compose traverses the working directory and its parent directories looking for a <code class="language-plaintext highlighter-rouge">docker-compose.yml</code> and a <code class="language-plaintext highlighter-rouge">docker-compose.override.yml</code> file. You must supply at least the <code class="language-plaintext highlighter-rouge">docker-compose.yml</code> file. If both files are present on the same directory level, Compose combines the two files into a single configuration.</p> <p>The configuration in the <code class="language-plaintext highlighter-rouge">docker-compose.override.yml</code> file is applied over and in addition to the values in the <code class="language-plaintext highlighter-rouge">docker-compose.yml</code> file.</p> <h3 id="specifying-a-path-to-a-single-compose-file">Specifying a path to a single Compose file</h3> <p>You can use the <code class="language-plaintext highlighter-rouge">-f</code> flag to specify a path to a Compose file that is not located in the current directory, either from the command line or by setting up a <a href="envvars/index#compose_file">COMPOSE_FILE environment variable</a> in your shell or in an environment file.</p> <p>For an example of using the <code class="language-plaintext highlighter-rouge">-f</code> option at the command line, suppose you are running the <a href="https://docs.docker.com/samples/rails/">Compose Rails sample</a>, and have a <code class="language-plaintext highlighter-rouge">docker-compose.yml</code> file in a directory called <code class="language-plaintext highlighter-rouge">sandbox/rails</code>. You can use a command like <a href="pull/index">docker-compose pull</a> to get the postgres image for the <code class="language-plaintext highlighter-rouge">db</code> service from anywhere by using the <code class="language-plaintext highlighter-rouge">-f</code> flag as follows: <code class="language-plaintext highlighter-rouge">docker-compose -f ~/sandbox/rails/docker-compose.yml pull db</code></p> <p>Here’s the full example:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker-compose -f ~/sandbox/rails/docker-compose.yml pull db +Pulling db (postgres:latest)... +latest: Pulling from library/postgres +ef0380f84d05: Pull complete +50cf91dc1db8: Pull complete +d3add4cd115c: Pull complete +467830d8a616: Pull complete +089b9db7dc57: Pull complete +6fba0a36935c: Pull complete +81ef0e73c953: Pull complete +338a6c4894dc: Pull complete +15853f32f67c: Pull complete +044c83d92898: Pull complete +17301519f133: Pull complete +dcca70822752: Pull complete +cecf11b8ccf3: Pull complete +Digest: sha256:1364924c753d5ff7e2260cd34dc4ba05ebd40ee8193391220be0f9901d4e1651 +Status: Downloaded newer image for postgres:latest +</pre></div> <h2 id="use--p-to-specify-a-project-name">Use <code class="language-plaintext highlighter-rouge">-p</code> to specify a project name</h2> <p>Each configuration has a project name. If you supply a <code class="language-plaintext highlighter-rouge">-p</code> flag, you can specify a project name. If you don’t specify the flag, Compose uses the current directory name. See also the <a href="envvars/index#compose_project_name">COMPOSE_PROJECT_NAME environment variable</a>.</p> <h2 id="use---profile-to-specify-one-or-more-active-profiles">Use <code class="language-plaintext highlighter-rouge">--profile</code> to specify one or more active profiles</h2> <p>Calling <code class="language-plaintext highlighter-rouge">docker-compose --profile frontend up</code> will start the services with the profile <code class="language-plaintext highlighter-rouge">frontend</code> and services without specified profiles. You can also enable multiple profiles, e.g. with <code class="language-plaintext highlighter-rouge">docker-compose --profile frontend --profile debug up</code> the profiles <code class="language-plaintext highlighter-rouge">frontend</code> and <code class="language-plaintext highlighter-rouge">debug</code> will be enabled.</p> <p>See also <a href="../profiles/index"><em>Using profiles with Compose</em></a> and the <a href="envvars/index#compose_profiles"><code class="language-plaintext highlighter-rouge">COMPOSE_PROFILES</code> environment variable</a>.</p> <h2 id="set-up-environment-variables">Set up environment variables</h2> <p>You can set <a href="envvars/index">environment variables</a> for various <code class="language-plaintext highlighter-rouge">docker-compose</code> options, including the <code class="language-plaintext highlighter-rouge">-f</code> and <code class="language-plaintext highlighter-rouge">-p</code> flags.</p> <p>For example, the <a href="envvars/index#compose_file">COMPOSE_FILE environment variable</a> relates to the <code class="language-plaintext highlighter-rouge">-f</code> flag, and <code class="language-plaintext highlighter-rouge">COMPOSE_PROJECT_NAME</code> <a href="envvars/index#compose_project_name">environment variable</a> relates to the <code class="language-plaintext highlighter-rouge">-p</code> flag.</p> <p>Also, you can set some of these variables in an <a href="../env-file/index">environment file</a>.</p> <h2 id="where-to-go-next">Where to go next</h2> <ul> <li><a href="envvars/index">CLI environment variables</a></li> <li><a href="../env-file/index">Declare default environment variables in 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>, <a href="https://docs.docker.com/search/?q=docker-compose">docker-compose</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/" class="_attribution-link">https://docs.docker.com/compose/reference/</a> + </p> +</div> |
