Docker Logo

Install Docker Compose

Share

A key driver for me blogging these tech guides is to allow me to recall things down the lane that I may need to do again. I’m using the blog as the platform to do that instead of say a bookmarks manager, in case it’s of interest to anyone else. This one’s a short and sweet set of steps required to install Docker Compose. Well documented and very standard stuff, but for some reason I’ve come across needlessly convoluted instructions a few time in the past, especially for Compose.

Install Docker

This is taken from the documentation at docker.com.

Set up the apt repository.

Bash
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

And then install the latest version.

Bash
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Optionally remove the need to call sudo when running Docker as a non-root user.

Bash
sudo usermod -aG docker ${USER}

${USER} is the current user, but this can be replaced with a user name also.

Docker Compose

Docker Compose instructions are also at docker.com. Simply run the following:

Bash
sudo apt-get update
sudo apt-get install docker-compose-plugin

And verify the install with:

Bash
docker compose version

Conclusion

Very simple stuff. Again, not sure why I’ve hit overly involved instructions a few times in the past. Possibly old documentation for a previous release or something. The above works fine with Docker 25.x and Compose 2.24.x releases however.