docs/compose/install/compose-plugin.md

7.7 KiB

description keywords toc_max title
How to install Docker Compose CLI plugin compose, orchestration, install, installation, docker, documentation 3 Install Docker Compose CLI plugin

On this page you can find instructions on how to install the Compose plugin for Docker CLI on Linux and Windows Server operating systems.

Note that installing Docker Compose as a plugin requires Docker CLI.

Installing Compose on Linux systems

In this section, you can find various methods for installing Compose on Linux.

Installation methods

  • Installing Docker Desktop for Linux{:target="blank" rel="noopener" class=""} is the easiest and recommended installation route. Check the Desktop for Linux supported platforms{:target="blank" rel="noopener" class=""} page to verify the supported Linux distributions and architectures.

The following other methods are possible:

  • Using the automated convenience scripts (for testing and development environments). These scripts install Docker Engine and Docker CLI with the Compose plugin. For this route, go to the Docker Engine install{:target="blank" rel="noopener" class=""} page and follow the provided instructions. After installing Desktop for Linux, this is the recommended route.

  • Setting up Docker's repository and using it to install Docker CLI Compose plugin. See the Install using the repository section on this page. This is the second best route.

  • Installing the Docker CLI Compose plugin manually. See the Install the plugin manually section on this page. Note that this option requires you to manage upgrades manually as well.

Install using the repository

Note

These instructions assume you already have Docker Engine and Docker CLI installed and now want to install the Compose plugin. For other Linux installation methods see this summary.

To run Compose as a non-root user, see Manage Docker as a non-root user{:target="blank" rel="noopener" class=""}.

If you have already set up the Docker repository jump to step 2.

  1. Set up the repository. Go to the "Set up the repository" section of the chosen Linux distribution{:target="blank" rel="noopener" class=""}. found on the Docker Engine installation pages to check the instructions.

  2. Update the apt package index, and install the latest version of Docker Compose:

    Or, if using a different distro, use the equivalent package manager instructions.

    $ sudo apt-get update
    $ sudo apt-get install docker-compose-plugin
    

    Alternatively, to install a specific version of Compose CLI plugin:

    a. List the versions available in your repo:

    $ apt-cache madison docker-compose-plugin
    
      docker-compose-plugin | 2.3.3~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable arm64 Packages
    

    b. From the list obtained use the version string you can in the second column to specify the version you wish to install.

    c. Install the selected version:

    $ sudo apt-get install docker-compose-plugin=<VERSION_STRING>
    

    where <VERSION_STRING> is, for example,2.3.3~ubuntu-focal.

  3. Verify that Docker Compose is installed correctly by checking the version.

    $ docker compose version
    Docker Compose version v2.3.3
    

Install the plugin manually

Note

These instructions assume you already have Docker Engine and Docker CLI installed and now want to install the Compose plugin.

Note as well this option requires you to manage upgrades manually. Whenever possible we recommend any of the other installation methods listed. For other Linux installation methods see this summary.

To run Compose as a non-root user, see Manage Docker as a non-root user.

  1. To download and install the Compose CLI plugin, run:

    $ DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
    $ mkdir -p $DOCKER_CONFIG/cli-plugins
    $ curl -SL https://github.com/docker/compose/releases/download/{{site.compose_version}}/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
    

    This command downloads the latest release of Docker Compose (from the Compose releases repository) and installs Compose for the active user under $HOME directory.

    To install:

    • Docker Compose for all users on your system, replace ~/.docker/cli-plugins with /usr/local/lib/docker/cli-plugins.
    • A different version of Compose, substitute {{site.compose_version}} with the version of Compose you want to use.
  2. Apply executable permissions to the binary:

    $ chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
    

    or, if you chose to install Compose for all users:

    $ sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
    
  3. Test the installation.

    $ docker compose version
    Docker Compose version {{site.compose_version}}
    

Note

Compose standalone: If you need to use Compose without installing the Docker CLI, the instructions for the standalone scenario are similar. Note the target folder for the binary's installation is different as well as the compose syntax used with the plugin (space compose) or the standalone version (dash compose).

  1. To download and install Compose standalone, run:
$ curl -SL https://github.com/docker/compose/releases/download/{{site.compose_version}}/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
  1. Apply executable permissions to the standalone binary in the target path for the installation.
  2. Test and execute compose commands using docker-compose.

Note

If the command docker-compose fails after installation, check your path. You can also create a symbolic link to /usr/bin or any other directory in your path. For example:

$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Install Compose on Windows Server

Follow these instructions if you are running the Docker daemon and client directly on Microsoft Windows Server and want to install Docker Compose.

  1. Run a PowerShell as an administrator. When asked if you want to allow this app to make changes to your device, click Yes in order to proceed with the installation.

  2. GitHub now requires TLS1.2. In PowerShell, run the following:

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    
  3. Run the following command to download the latest release of Compose ({{site.compose_version}}):

    Invoke-WebRequest "https://github.com/docker/compose/releases/download/{{site.compose_version}}/docker-compose-Windows-x86_64.exe" -UseBasicParsing -OutFile $Env:ProgramFiles\Docker\docker-compose.exe
    

    Note

    On Windows Server 2019 you can add the Compose executable to $Env:ProgramFiles\Docker. Because this directory is registered in the system PATH, you can run the docker-compose --version command on the subsequent step with no additional configuration.

    To install a different version of Compose, substitute {{site.compose_version}} with the version of Compose you want to use.

  4. Test the installation.

    $ docker compose version
    Docker Compose version {{site.compose_version}}