(Last Updated On: December 5, 2018)

Docker Compose is a tool used to define and run multi-container Docker applications. The application services are configured using a Compose file. Unlike running docker commands, a single command is all that’s required to create and start all the services from your configuration.

Docker Compose is a great tool for development, testing, and staging environments,
as well as CI workflows. Install it on your Fedora using the steps provided below.

Step 1: Install Docker Engine

Docker Compose requires Docker Engine to be installed on the host system before it can be used. Install Docker on Fedora 29 and Fedora 28 system using our guide below.

How to install Docker on Fedora 29 / Fedora 28

Step 2: Install Docker Compose on Fedora 29 / Fedora 28

After the Docker Engine has been installed, the next step is the installation of Docker Compose on Fedora 29 / Fedora 28. There are two ways you can install Docker Compose on Fedora 29 / Fedora 28.

  • Install Docker Compose on Fedora 29 / Fedora 28 from RPM repository
  • Install from Source binary file

Install Docker Compose on Fedora 29 / Fedora 28 from the repo

If you would like to install the version of Docker Compose available on Fedora upstream repository, just run the command:

sudo dnf -y install docker-compose

This may not install the most current version of Docker Compose. You can check what is installed using the rpm command.

$ rpm -qi docker-compose
Name        : docker-compose
Version     : 1.22.0
Release     : 2.fc29
Architecture: noarch
Install Date: Tue 04 Dec 2018 08:46:26 PM UTC
Group       : Unspecified
Size        : 977838
License     : ASL 2.0
Signature   : RSA/SHA256, Mon 08 Oct 2018 04:21:11 PM UTC, Key ID a20aa56b429476b4
Source RPM  : docker-compose-1.22.0-2.fc29.src.rpm
Build Date  : Mon 08 Oct 2018 04:18:48 PM UTC
Build Host  : buildvm-13.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : https://github.com/docker/compose
Bug URL     : https://bugz.fedoraproject.org/docker-compose
Summary     : Multi-container orchestration for Docker
Description :
Compose is a tool for defining and running multi-container Docker
applications. With Compose, you use a Compose file to configure your
application's services. Then, using a single command, you create and
start all the services from your configuration.

Install Docker Compose on Fedora 29 / Fedora 28 from a binary file.

Please check the latest release of Docker Compose on the Official Compose releases page before downloading. As of this writing, the latest release is “1.23.2”

Download latest compose

export VER="1.23.2"
sudo curl -L "https://github.com/docker/compose/releases/download/${VER}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

The command above will save the file to /usr/local/bin/docker-compose. Apply executable permissions to the binary:

sudo chmod +x /usr/local/bin/docker-compose

Validate version:

$ docker-compose --version
docker-compose version 1.23.2, build 1110ad01

Step 3: Configure Compose Command-line completion

Compose comes with command completion for the bash and zsh shell.

For Bash users

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

sudo curl -L https://raw.githubusercontent.com/docker/compose/${VER}/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose

For Zsh users

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

mkdir -p ~/.zsh/completion
curl -L https://raw.githubusercontent.com/docker/compose/${VER}/contrib/completion/zsh/_docker-compose > ~/.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

You have learned how to Install Docker Compose on Fedora 29 / Fedora 28. Visit Compose getting started page for how to use Compose.