You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

How do I install Docker Compose on Ubuntu 20.04/18.04 / Debian 10 / CentOS 8 / Fedora 33/32/31?. This guide will show you how to Install the Latest Docker Compose on Linux. Compose is a tool for defining and running multi-container Docker application. A YAML file is used to configure your application’s services.

This post aims to be a concise instructional step-by-step guide for developers and SysAdmins seeking to setup Docker Compose on Linux. We will check the Github API releases page for the project, and pull the latest binary file.

Install Latest Docker Compose on Linux

You need curl installed on your system for this operation. And definitely, access to the Terminal as a user with sudo privileges.

---- CentOS / RHEL -----
$ sudo yum -y install curl

---- Debian / Ubuntu ----
$ sudo apt install -y curl

----- Fedora -----
$ sudo dnf -y install curl

Once curl has been installed, download the latest Compose on your Linux machine.

curl -s \
  | grep browser_download_url \
  | grep docker-compose-Linux-x86_64 \
  | cut -d '"' -f 4 \
  | wget -qi -

Make the binary file executable.

chmod +x docker-compose-Linux-x86_64

Move the file to your PATH.

sudo mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose

Confirm version.

$ docker-compose version
docker-compose version 1.28.6, build 5db8d86f
docker-py version: 4.4.4
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

Add user to docker group:

sudo usermod -aG docker $USER
newgrp docker

Configure Compose Command-line completion

Compose has command completion for the bash and zsh shell.

For Bash users

Place the completion script in /etc/bash_completion.d/.

sudo curl -L -o /etc/bash_completion.d/docker-compose

Source the file or re-login to enjoy completion feature.

source /etc/bash_completion.d/docker-compose

For Zsh users

Download the completion script in your ~/.zsh/completion/

mkdir -p ~/.zsh/completion
curl -L > ~/.zsh/completion/_docker-compose

Include the directory in your $fpath by adding in ~/.zshrc:

fpath=(~/.zsh/completion $fpath)

Make sure compinit is loaded or do it by adding in ~/.zshrc:

autoload -Uz compinit && compinit -i

Then reload your shell:

exec $SHELL -l

Test Docker Compose installation.

Our comprehensive guide is on Managing Docker Containers with Docker Compose

Create a test Docker Compose file.

$ vim docker-compose.yml

Add below data to the file.

version: '3'  
    image: nginx:latest
     - "8080:80"
     - php
    image: php:7-fpm

Start service containers.

$ docker-compose up -d
Starting root_php_1 … done
Starting root_web_1 … done


Show running Containers

$ docker-compose ps
   Name                 Command              State          Ports        
root_php_1   docker-php-entrypoint php-fpm   Up      9000/tcp            
root_web_1   nginx -g daemon off;            Up>80/tcp

Destroy containers

$ docker-compose stop
Stopping root_web_1 ... done
Stopping root_php_1 ... done

$ docker-compose rm -f
Going to remove root_web_1, root_php_1
Removing root_web_1 ... done
Removing root_php_1 ... done

Go through Official Docker documentation and Docker Compose documentation to learn more.

More guides:

Ctop – Top command for container metrics

How to Install Portainer Docker UI manager

How To run Local Kubernetes clusters in Docker

Deploy Lightweight Kubernetes with MicroK8s and Snap

How to run Minikube on KVM

As an appreciation for the content we put out,
we would be thrilled if you support us!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here