DEV Community

Cover image for How to Install the latest version of Docker Compose on Alpine Linux(in 2022)
Ajeet Singh Raina for Docker

Posted on • Edited on • Originally published at collabnix.com

How to Install the latest version of Docker Compose on Alpine Linux(in 2022)

Docker Compose V2 is the latest Compose version that went GA early this year during April 26, 2022. Compose V2 is the standard across all documentation, and Compose V2 will become the developer default on Docker Desktop. However, you can continue aliasing docker-compose to docker compose and opt-out of V2 via the Docker Desktop UI — or by entering the docker-compose disable-v2 command.

What if I use Linux?

Docker Desktop for Linux is now in beta and includes Compose V2. Alternatively, you can manually install Docker Compose V2 for Linux. In Moby v20.10.13, we’ve included compose-plugin as an optional Docker CLI plugin for easier installation. Check out our documentation for more information.

Compose V2 offers all of Compose V1’s functionality to help you efficiently run your multi-container applications. The transition to Go was one of our most liked roadmap items and has enabled us to deliver more features at a faster rate. These are now integrated into the Docker CLI, creating a seamless user experience across Docker’s tools. Read more about key features introduced in V2.

Step 1. Open the APK repository configuration file:

vi /etc/apk/repositories
Enter fullscreen mode Exit fullscreen mode

Step 2. Add the following two lines:

#/media/cdrom/apks
http://ftp.halifax.rwth-aachen.de/alpine/v3.16/main
http://ftp.halifax.rwth-aachen.de/alpine/v3.16/community
Enter fullscreen mode Exit fullscreen mode

Step 3. Update the Repo

apk update
Enter fullscreen mode Exit fullscreen mode

Step 4. Install Docker and Docker Compose

apk add docker docker-cli-compose
Enter fullscreen mode Exit fullscreen mode

Step 5. Verify the Docker and Docker Compose version

$ docker version
Client:
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.17.11
 Git commit:        100c701
 Built:             Mon Jun  6 22:56:42 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Jun  6 23:01:45 2022
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          v1.6.6
  GitCommit:        10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc:
  Version:          1.1.2
  GitCommit:        v1.1.2-0-ga916309f
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
Enter fullscreen mode Exit fullscreen mode

Step 6: Verify Docker Compose Version

$ docker compose version
Docker Compose version v2.6.1
Enter fullscreen mode Exit fullscreen mode

Getting Help

Have a question about Docker Compose? Search the Docker Forum Docker Compose tag for answers, or post a question in our Docker Community Forum.

Top comments (4)

Collapse
 
ericbl profile image
Eric

thanks.
I also figured out that steps 1 and 2 are not required anymore since the docker-cli-compose is already in the standard 'community' repo:
https://pkgs.alpinelinux.org/packages?name=docker-cli-compose&branch=edge&repo=&arch=&maintainer=

Collapse
 
ajeetraina profile image
Ajeet Singh Raina • Edited

It's always safe to add those steps esp. for those who are not running the latest version of Alpine.

Collapse
 
ericbl profile image
Eric

step 4 is wrong and only get docker-compose v1
it should read
apk add docker docker-cli-compose
to get v2

Collapse
 
ajeetraina profile image
Ajeet Singh Raina

Thanks. I have fixed it.