How to install Docker Compose on Linux

Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.

Case 1: Install Docker Desktop

The easiest and recommended way to get Docker Compose is to install Docker Desktop. Docker Desktop includes Docker Compose along with Docker Engine and Docker CLI which are Compose prerequisites.

Docker Desktop is available on:

If you have already installed Docker Desktop, you can check which version of Compose you have by selecting About Docker Desktop from the Docker menu whale menu

Case 2: Install the Compose plugin

If you already have Docker Engine and Docker CLI installed, you can install the Compose plugin from the command line, by either:

Note

This is only available on Linux

Install using the repository

  1. Set up the repository. Find distro-specific instructions in:Ubuntu | CentOS | Debian | Fedora | RHEL | SLES.
  2. Update the package index, and install the latest version of Docker Compose:
    • For Ubuntu and Debian, run:
      • sudo apt-get update
      • sudo apt-get install docker-compose-plugin
    • For RPM-based distros, run:
      • sudo yum update
      • sudo yum install docker-compose-plugin
  3. Verify that Docker Compose is installed correctly by checking the version.
    • docker compose version

Update Compose

To update the Compose plugin, run the following commands:

  • For Ubuntu and Debian, run:
    • sudo apt-get update
    • sudo apt-get install docker-compose-plugin
  • For RPM-based distros, run:
    • sudo yum update
    • sudo yum install docker-compose-plugin

Install the plugin manually

  1. curl -SL https://github.com/docker/compose/releases/download/v2.14.0/docker-compose-linux-x86_64 -o -o /usr/local/bin/docker-compose
  2. sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
  3. to verify: docker-compose --version

curl -SLhttps://github.com/docker/compose/releases/download/v2.14.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

In this you need not to give OS type and architeture

Note:

  • A different version of Compose, substitute v2.14.0 with the version of Compose you want to use.
  • For a different architecture, substitute x86_64 with the architecture you want.

Leave a Reply