Install Docker Compose
Estimated reading time: 5 minutes
You can run Compose on macOS, Windows, and 64-bit Linux.
Prerequisites
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.
-
On desktop systems like Docker Desktop for Mac and Windows, Docker Compose is included as part of those desktop installs.
-
On Linux systems, first install the Docker Engine for your OS as described on the Get Docker page, then come back here for instructions on installing Compose on Linux systems.
-
To run Compose as a non-root user, see Manage Docker as a non-root user.
Install Compose
Follow the instructions below to install Compose on Mac, Windows, Windows Server 2016, or Linux systems.
Install a different version
The instructions below outline installation of the current stable release (v2.0.0) of Compose. To install a different version of Compose, replace the given release number with the one that you want. Compose releases are also listed and available for direct download on the Compose repository release page on GitHub. To install a pre-release of Compose, refer to the install pre-release builds section.
Install Compose on macOS
Docker Desktop for Mac includes Compose along with other Docker apps, so Mac users do not need to install Compose separately. For installation instructions, see Install Docker Desktop on Mac.
Install Compose on Windows desktop systems
Docker Desktop for Windows includes Compose along with other Docker apps, so most Windows users do not need to install Compose separately. For install instructions, see Install Docker Desktop on Windows.
If you are running the Docker daemon and client directly on Microsoft Windows Server, follow the instructions in the Windows Server tab.
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.
-
Start an “elevated” PowerShell (run it as administrator). Search for PowerShell, right-click, and choose Run as administrator. When asked if you want to allow this app to make changes to your device, click Yes.
-
In PowerShell, since GitHub now requires TLS1.2, run the following:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Then run the following command to download the current stable release of Compose (v2.0.0):
Invoke-WebRequest "https://github.com/docker/compose/releases/download/2.0.0/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 `2.0.0`
> with the version of Compose you want to use.
-
Test the installation.
docker compose --version docker compose version 2.0.0, build 01110ad01
Install Compose on Linux systems
On supported Linux distributions, you can install Docker Compose using
the docker-compose-plugin
system package. See Engine installation instruction
Alternatively, you can download the Docker Compose binary from the
Compose repository release page on GitHub.
Follow the instructions from the link, which involve running the curl
command
in your terminal to download the binaries. These step-by-step instructions are
also included below.
-
Run this command to download the current stable release of Docker Compose:
$ mkdir -p ~/.docker/cli-plugins $ sudo curl -L "https://github.com/docker/compose/releases/download/2.0.0/docker-compose-$(uname -s)-$(uname -m)" -o ~/.docker/cli-plugins/docker-compose
This command installs Compose V2 for the active user under $HOME directory. To install for all users on your system, replace
~/.docker/cli-plugins
by/usr/local/lib/docker/cli-plugins
. -
Apply executable permissions to the binary:
$ sudo chmod +x ~/.docker/cli-plugins/docker-compose
-
Test the installation.
$ docker compose --version Docker Compose version 2.0.0
Uninstallation
To uninstall Docker Compose if you installed using curl
:
$ sudo rm ~/.docker/cli-plugins/docker-compose
Install pre-release builds
If you’re interested in trying out a pre-release build, you can download release
candidates from the Compose repository release page on GitHub.
Follow the instructions from the link, which involves running the curl
command
in your terminal to download the binaries.
Pre-release builds allow you to try out new features before they are released, but may be less stable.
Got a “Permission denied” error?
If you get a “Permission denied” error using either of the above methods, you probably do not have the proper permissions to remove
docker-compose
. To force the removal, prependsudo
to either of the above commands and run again.