This page contains information on how to install Docker Compose. You can run Compose on macOS, Windows, and 64-bit Linux.
⚠️ The installation instructions on this page will help you to install Compose v1 which is a deprecated version. We recommend that you use the latest version of Docker Compose.
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.
-
Install Docker Engine for your OS and then come back here for instructions on installing the Python version of Compose.
-
To run Compose as a non-root user, see Manage Docker as a non-root user.
Follow the instructions below to install Compose using the pip
Python package manager or to install Compose as a container.
Install a different version
The instructions below outline installation of the current stable release (v1.29.2) of Compose. To install a different version of Compose, replace the given release number with the one that you want. For instructions to install Compose 2.x.x on Linux, see Install Compose 2.x.x on Linux.
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.
For
alpine
, the following dependency packages are needed:py-pip
,python3-dev
,libffi-dev
,openssl-dev
,gcc
,libc-dev
,rust
,cargo
, andmake
. {: .important}
You can install Compose from
pypi using pip
. If you install
using pip
, we recommend that you use a
virtualenv because many operating
systems have python system packages that conflict with docker-compose
dependencies. See the virtualenv
tutorial to get
started.
$ pip3 install docker-compose
If you are not using virtualenv,
$ sudo pip install docker-compose
pip version 6.0 or greater is required.
You can also run Compose inside a container, from a small bash script wrapper. To install Compose as a container run this command:
$ sudo curl -L --fail https://github.com/docker/compose/releases/download/1.29.2/run.sh -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
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-releases built from the "master" branch are also available for download at https://dl.bintray.com/docker-compose/master/.
Pre-release builds allow you to try out new features before they are released, but may be less stable.
If you're upgrading from Compose 1.2 or earlier, remove or migrate your existing containers after upgrading Compose. This is because, as of version 1.3, Compose uses Docker labels to keep track of containers, and your containers need to be recreated to add the labels.
If Compose detects containers that were created without labels, it refuses to run, so that you don't end up with two sets of them. If you want to keep using your existing containers (for example, because they have data volumes you want to preserve), you can use Compose 1.5.x to migrate them with the following command:
$ docker-compose migrate-to-labels
Alternatively, if you're not worried about keeping them, you can remove them. Compose just creates new ones.
$ docker container rm -f -v myapp_web_1 myapp_db_1 ...
To uninstall Docker Compose if you installed using curl
:
$ sudo rm /usr/local/bin/docker-compose
To uninstall Docker Compose if you installed using pip
:
$ pip uninstall docker-compose
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.