summaryrefslogtreecommitdiff
path: root/devdocs/docker/compose%2Finstall%2Findex.html
blob: f6bafd5ce0d046cf7b11b71c4bdef2c19e6e226b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<h1>Install Docker Compose</h1>

<p>This page contains information on how to install Docker Compose. You can run Compose on macOS, Windows, and 64-bit Linux.</p> <h2 id="prerequisites">Prerequisites</h2> <p>Docker Compose relies on Docker Engine for any meaningful work, so make sure you have Docker Engine installed either locally or remote, depending on your setup.</p> <ul> <li> <p>On desktop systems like Docker Desktop for Mac and Windows, Docker Compose is included as part of those desktop installs.</p> </li> <li> <p>On Linux systems, you can install Docker Compose with the Docker Engine using the <a href="../../engine/install/index#server" target="_blank" rel="noopener" class="_">convenience script</a>. Select the install Docker Engine page for your distribution and then look for instructions on installing using the convenience script.<br> Otherwise, you should first install the <a href="../../engine/install/index#server" target="_blank" rel="noopener" class="_">Docker Engine</a> for your OS and then refer to this page for instructions on installing Compose on Linux systems.</p> </li> <li> <p>To run Compose as a non-root user, see <a href="../../engine/install/linux-postinstall/index">Manage Docker as a non-root user</a>.</p> </li> </ul> <h2 id="install-compose">Install Compose</h2> <p>Follow the instructions below to install Compose on Mac, Windows, Windows Server, or Linux systems.</p> <blockquote> <p>Install a different version</p> <p>The instructions below outline installation of the current stable release (<strong>v2.5.0</strong>) of Compose. To install a different version of Compose, replace the given release number with the one that you want.</p> <p>Compose releases are also listed and available for direct download on the <a href="https://github.com/docker/compose/releases" target="_blank" rel="noopener" class="_">Compose repository release page on GitHub</a>.</p> <p>To install the Python version of Compose, follow instructions in the <a href="https://github.com/docker/compose/blob/master/INSTALL/" target="_blank" rel="noopener" class="_">Compose v1 GitHub branch</a>.</p> </blockquote> <ul class="nav nav-tabs"> <li class="active"><a data-toggle="tab" data-target="#macOS">Mac</a></li> <li><a data-toggle="tab" data-target="#windows">Windows</a></li> <li><a data-toggle="tab" data-target="#windows-server">Windows Server</a></li> <li><a data-toggle="tab" data-target="#linux">Linux</a></li> <li><a data-toggle="tab" data-target="#linux-standalone">Linux Standalone binary</a></li> </ul> <div class="tab-content"> <div id="macOS" class="tab-pane fade in active"> <h3 id="install-compose-on-macos">Install Compose on macOS</h3> <p><strong>Docker Desktop for Mac</strong> includes Compose along with other Docker apps, so Mac users do not need to install Compose separately. For installation instructions, see <a href="https://docs.docker.com/desktop/mac/install/">Install Docker Desktop on Mac</a>.</p> </div> <div id="windows" class="tab-pane fade"> <h3 id="install-compose-on-windows-desktop-systems">Install Compose on Windows desktop systems</h3> <p><strong>Docker Desktop for Windows</strong> includes Compose along with other Docker apps, so most Windows users do not need to install Compose separately. For install instructions, see <a href="https://docs.docker.com/desktop/windows/install/">Install Docker Desktop on Windows</a>.</p> <p>If you are running the Docker daemon and client directly on Microsoft Windows Server, follow the instructions in the Windows Server tab.</p> </div> <div id="windows-server" class="tab-pane fade"> <h3 id="install-compose-on-windows-server">Install Compose on Windows Server</h3> <p>Follow these instructions if you are running the Docker daemon and client directly on Microsoft Windows Server and want to install Docker Compose.</p> <ol> <li> <p>Start an “elevated” PowerShell (run it as administrator). Search for PowerShell, right-click, and choose <strong>Run as administrator</strong>. When asked if you want to allow this app to make changes to your device, click <strong>Yes</strong>.</p> </li> <li> <p>In PowerShell, since GitHub now requires TLS1.2, run the following:</p> <div class="highlight"><pre class="highlight" data-language="">[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
</pre></div>  <p>Then run the following command to download the current stable release of Compose (v2.5.0):</p> <div class="highlight"><pre class="highlight" data-language="">Invoke-WebRequest "https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-Windows-x86_64.exe" -UseBasicParsing -OutFile $Env:ProgramFiles\Docker\docker-compose.exe
</pre></div>  <blockquote> <p><strong>Note</strong></p> <p>On Windows Server 2019, you can add the Compose executable to <code class="language-plaintext highlighter-rouge">$Env:ProgramFiles\Docker</code>. Because this directory is registered in the system <code class="language-plaintext highlighter-rouge">PATH</code>, you can run the <code class="language-plaintext highlighter-rouge">docker-compose --version</code> command on the subsequent step with no additional configuration.</p> </blockquote> <blockquote> <p>To install a different version of Compose, substitute <code class="language-plaintext highlighter-rouge">v2.5.0</code> with the version of Compose you want to use.</p> </blockquote> </li> <li> <p>Test the installation.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker compose version
Docker Compose version v2.5.0
</pre></div>  </li> </ol> </div> <div id="linux" class="tab-pane fade"> <h3 id="install-compose-on-linux-systems">Install Compose on Linux systems</h3> <p>You can install Docker Compose in different ways, depending on your needs:</p> <ul> <li>In testing and development environments, some users choose to use automated <a href="#install-using-the-convenience-script">convenience scripts</a> to install Docker.</li> <li>Most users <a href="#install-using-the-repository">set up Docker’s repositories</a> and install from them, for ease of installation and upgrade tasks. This is the recommended approach.</li> <li>Some users <a href="#install-the-binary-manually">download and install the binary</a>, and manage upgrades manually.</li> </ul> <h4 id="install-using-the-convenience-script">Install using the convenience script</h4> <p>As Docker Compose is now part of the Docker CLI it can be installed via a convenience script with Docker Engine and the CLI.<br> <a href="../../engine/install/index#server">Choose your Linux distribution</a> and follow the instructions.</p> <h4 id="install-using-the-repository">Install using the repository</h4> <p>If you already follow the instructions to install Docker Engine, Docker Compose should already be installed. <br> Otherwise, you can set up the Docker repository as mentioned in the Docker Engine installation, <a href="../../engine/install/index#server">choose your Linux distribution</a> and go to the <code class="language-plaintext highlighter-rouge">Set up the repository</code> section.</p> <p>When finished</p> <ol> <li> <p>Update the <code class="language-plaintext highlighter-rouge">apt</code> package index, and install the <em>latest version</em> of Docker Compose, or go to the next step to install a specific version:</p> <div class="highlight"><pre class="highlight" data-language=""> $ sudo apt-get update
 $ sudo apt-get install docker-compose-plugin
</pre></div>  </li> <li> <p>To install a <em>specific version</em> of Docker Engine, list the available versions in the repo, then select and install:</p> <p>a. List the versions available in your repo:</p> <div class="highlight"><pre class="highlight" data-language="">$ apt-cache madison docker-compose-plugin

  docker-compose-plugin | 2.3.3~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable arm64 Packages
</pre></div>  <p>b. Install a specific version using the version string from the second column, for example, <code class="language-plaintext highlighter-rouge">2.3.3~ubuntu-focal</code>.</p> <div class="highlight"><pre class="highlight" data-language="">$ sudo apt-get install docker-compose-plugin=&lt;VERSION_STRING&gt;
</pre></div>  </li> <li> <p>Verify that Docker Compose is installed correctly by checking the version.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker compose version
Docker Compose version v2.3.3
</pre></div>  </li> </ol> <h4 id="install-the-binary-manually">Install the binary manually</h4> <p>On Linux, you can download the Docker Compose binary from the <a href="https://github.com/docker/compose/releases" target="_blank" rel="noopener" class="_">Compose repository release page on GitHub</a> and copying it into <code class="language-plaintext highlighter-rouge">$HOME/.docker/cli-plugins</code> as <code class="language-plaintext highlighter-rouge">docker-compose</code>. Follow the instructions from the link, which involve running the <code class="language-plaintext highlighter-rouge">curl</code> command in your terminal to download the binaries. These step-by-step instructions are also included below.</p> <ol> <li> <p>Run this command to download the current stable release of Docker Compose:</p> <div class="highlight"><pre class="highlight" data-language="">$ DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
$ mkdir -p $DOCKER_CONFIG/cli-plugins
$ curl -SL https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
</pre></div>  <p>This command installs Compose for the active user under <code class="language-plaintext highlighter-rouge">$HOME</code> directory. To install Docker Compose for all users on your system, replace <code class="language-plaintext highlighter-rouge">~/.docker/cli-plugins</code> with <code class="language-plaintext highlighter-rouge">/usr/local/lib/docker/cli-plugins</code>.</p> <blockquote> <p>To install a different version of Compose, substitute <code class="language-plaintext highlighter-rouge">v2.5.0</code> with the version of Compose you want to use.</p> </blockquote> </li> <li> <p>Apply executable permissions to the binary:</p> <div class="highlight"><pre class="highlight" data-language=""> $ chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
</pre></div>  <p>or if you choose to install Compose for all users</p> <div class="highlight"><pre class="highlight" data-language=""> $ sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
</pre></div>  </li> <li> <p>Test the installation.</p> <div class="highlight"><pre class="highlight" data-language=""> $ docker compose version
 Docker Compose version v2.5.0
</pre></div>  </li> </ol> </div> <div id="linux-standalone" class="tab-pane fade"> <h3 id="install-compose-as-standalone-binary-on-linux-systems">Install Compose as standalone binary on Linux systems</h3> <p>You can use Compose as a standalone binary without installing the Docker CLI.</p> <ol> <li>Run this command to download the current stable release of Docker Compose:</li> </ol> <div class="highlight"><pre class="highlight" data-language="">  $ curl -SL https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
</pre></div>  <blockquote> <p>To install a different version of Compose, substitute <code class="language-plaintext highlighter-rouge">v2.5.0</code> with the version of Compose you want to use.</p> </blockquote> <ol> <li>Apply executable permissions to the binary:</li> </ol> <div class="highlight"><pre class="highlight" data-language="">  $ sudo chmod +x /usr/local/bin/docker-compose
</pre></div>  <blockquote> <p><strong>Note</strong>:</p> <p>If the command <code class="language-plaintext highlighter-rouge">docker-compose</code> fails after installation, check your path. You can also create a symbolic link to <code class="language-plaintext highlighter-rouge">/usr/bin</code> or any other directory in your path.</p> <p>For example:</p> <div class="highlight"><pre class="highlight" data-language="">$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
</pre></div>  </blockquote> <ol> <li> <p>Test the installation.</p> <div class="highlight"><pre class="highlight" data-language=""> $ docker-compose --version
 Docker Compose version v2.5.0
</pre></div>  </li> </ol> </div> </div>  <h2 id="uninstallation">Uninstallation</h2> <p>To uninstall Docker Compose if you installed using <code class="language-plaintext highlighter-rouge">curl</code>:</p> <div class="highlight"><pre class="highlight" data-language="">$ rm $DOCKER_CONFIG/cli-plugins/docker-compose
</pre></div> <p>or if you choose to install Compose for all users</p> <div class="highlight"><pre class="highlight" data-language="">$ sudo rm /usr/local/lib/docker/cli-plugins/docker-compose
</pre></div> <blockquote> <p>Got a “Permission denied” error?</p> <p>If you get a “Permission denied” error using either of the above methods, you probably do not have the proper permissions to remove <code class="language-plaintext highlighter-rouge">docker-compose</code>. To force the removal, prepend <code class="language-plaintext highlighter-rouge">sudo</code> to either of the above commands and run again.</p> </blockquote> <h2 id="where-to-go-next">Where to go next</h2> <ul> <li><a href="../index">User guide</a></li> <li><a href="../gettingstarted/index">Getting Started</a></li> <li><a href="../reference/index">Command line reference</a></li> <li><a href="../compose-file/index">Compose file reference</a></li> <li><a href="../samples-for-compose/index">Sample apps with Compose</a></li> </ul> 
<p><a href="https://docs.docker.com/search/?q=compose">compose</a>, <a href="https://docs.docker.com/search/?q=orchestration">orchestration</a>, <a href="https://docs.docker.com/search/?q=install">install</a>, <a href="https://docs.docker.com/search/?q=installation">installation</a>, <a href="https://docs.docker.com/search/?q=docker">docker</a>, <a href="https://docs.docker.com/search/?q=documentation">documentation</a></p>
<div class="_attribution">
  <p class="_attribution-p">
    &copy; 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/install/" class="_attribution-link">https://docs.docker.com/compose/install/</a>
  </p>
</div>