How to install docker compose

January 1, 2024 / How-to Guide

Docker-compose is a useful tool for defining and running multi-container Docker applications. Instead of individual commands for each container, you can specify the entire environment in a single ‘docker-compose.yml’ file and launch the entire application stack with a single command (docker-compose up).

In this article, we’ll go through the steps of installing docker-compose on different platforms.

Requirements

  • Make sure Docker is installed on your machine.
  • User with sudo or root privileges required.

Installation on Linux

  1. Download the Docker Compose binary.
    Utilise the curl tool to fetch the latest Docker Compose version. At the time of writing, the current version (2.22.0) is available on GitHub with this command:

    $ sudo curl -L "https://github.com/docker/compose/releases/download/v2.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

    Ensure to visit the Docker Compose GitHub release page to discover the most recent version.

  2. Grant executable permissions
    Once you download, you must grant executable permissions to the binary:

    $ sudo chmod +x /usr/local/bin/docker-compose
  3. Verify the installation
    Check that Docker Compose is installed correctly by:

    $ docker-compose --version

    This command should display the installed version.

Installation on Windows

Docker Compose comes bundled with Docker Desktop for Windows. If you have installed Docker for Windows, you already have Docker Compose!

  1. Install Docker Desktop for Windows
    Visit the Docker website and download the Docker Desktop application for Windows.
  2. Now, verify the installation
    Now, you need to open a command prompt or PowerShell session and type:

    $ docker-compose --version

    Executing this command will display the installed version of Docker Compose.

Installation on macOS

Similar to Windows, Docker Compose comes included with the Docker Desktop for Mac application.

  1. Install Docker Desktop on macOS.
    Visit the Docker website and download Docker Desktop for macOS.
  2. Confirm the installation.
    Now, open a terminal window and type:

    $ docker-compose --version

    You should see the installed version of Docker Compose.

Another Method: Install using pip (Python Package Installer)

On platforms supporting Python and pip, Docker Compose can be installed as a Python package:

  1. Install pip
    On numerous systems, you can utilise the package manager to install pip. For example, on Debian-based systems:

    $ sudo apt-get install python3-pip
  2. Install docker-compose
    After installing pip:

    $ pip3 install docker-compose
  3. Now, verify the installation
    Check out the version:

    $ docker-compose --version

Docker Compose makes it easy to handle multiple Docker applications. Once it’s installed, you can create strong, well-organised applications using simple YAML files.

Stay updated with the latest installation guidelines and best practices by checking the official documentation regularly as Docker and its ecosystem develop.

Deploying containerised applications with Docker Compose?
A Linux VPS Hosting solution provides full root access, dedicated resources and the flexibility needed to run Docker, containers and modern application stacks efficiently.

For instructions on installing Python on Debian 12, see our guide How to Install Python on Debian 12

Spread the love