FG
☁️ Cloud & DevOpsDocker

How to install docker-compose v2 on Linux

Freshabout 21 hours ago
Mar 14, 20260 views
Confidence Score57%
57%

Problem

Description I'm trying to allow DDEV to use docker-compose v2 and don't have the resources for a whole set of tests on every macOS variant... but I thought it would be nice to run all the tests using docker-compose v2 on Linux (where it hasn't been introduced yet to my knowledge?) I followed the linux instructions in https://github.com/docker/compose-cli/blob/main/INSTALL.md but that doesn't do anything I can detect (`curl -L https://raw.githubusercontent.com/docker/compose-cli/main/scripts/install/install_linux.sh | sh`) (and doesn't enable the `docker compose` command either). How can I use docker-compose v2 on Linux?

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Install Docker Compose V2 on Linux

Medium Risk

Docker Compose V2 is not included in the default Docker installation on Linux systems. The command 'docker compose' is part of the Docker CLI plugin system, which may not be properly installed or configured on your system.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Update Docker to the Latest Version

    Ensure that you have the latest version of Docker installed, as Docker Compose V2 is integrated into Docker starting from version 20.10.0.

    bash
    sudo apt-get update && sudo apt-get install docker-ce docker-ce-cli containerd.io
  2. 2

    Install Docker Compose V2 Plugin

    Use the following command to download and install the Docker Compose V2 plugin directly from the Docker GitHub repository.

    bash
    mkdir -p ~/.docker/cli-plugins && curl -SL https://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose && chmod +x ~/.docker/cli-plugins/docker-compose
  3. 3

    Verify Installation

    Check if Docker Compose V2 is installed correctly by running the command below. It should return the version of Docker Compose.

    bash
    docker compose version
  4. 4

    Set Up DDEV to Use Docker Compose V2

    Ensure DDEV is configured to use Docker Compose V2 by updating its configuration files or environment settings as needed.

    bash
    ddev config global --docker-compose-version=2

Validation

Run 'docker compose version' to confirm that Docker Compose V2 is correctly installed and integrated with Docker. Additionally, run a simple DDEV command to ensure it is using the correct version of Docker Compose.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

dockerdocker-composecontainerskind/docs