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.

Install Docker Engine

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

Install Docker Compose on Fedora

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

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

Method 1: Install Docker Compose from a binary file

Please check the latest release of Docker Compose on the Official Compose releases page before downloading.

Install wget:

sudo dnf -y install wget

Download latest compose:

curl -s https://api.github.com/repos/docker/compose/releases/latest \
  | 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

The command above will save the file to /usr/local/bin/docker-compose. Validate version:

$ docker-compose --version
Docker Compose version v2.21.0

Method 2: Install Docker Compose from OS repo (Not latest package)

Install Docker YUM repo for fedora.

sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

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-plugin
Name        : docker-compose-plugin
Epoch       : 0
Version     : 2.21.0
Release     : 1.fc39
Architecture: x86_64
Install Date: Tue 14 Nov 2023 02:14:48 AM UTC
Group       : Tools/Docker
Size        : 60797169
License     : ASL 2.0
Signature   : RSA/SHA512, Thu 26 Oct 2023 03:07:04 PM UTC, Key ID c52feb6b621e9f35
Source RPM  : docker-compose-plugin-2.21.0-1.fc39.src.rpm
Build Date  : Thu 26 Oct 2023 09:12:20 AM UTC
Build Host  : 0abc15a5a166
Packager    : Docker <[email protected]>
Vendor      : Docker
URL         : https://github.com/docker/compose/
Summary     : Docker Compose (V2) plugin for the Docker CLI
....

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/master/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
source /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 Linux system. Visit Compose getting started page for how to use Compose.

Also check:

YOU CAN SUPPORT OUR WORK WITH A CUP OF COFFEE


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.

2 COMMENTS

  1. Hi! But Docker-compose has a problem with firewalld on Fedora 33 (and maybe earlier versions). Can you mention this issue and how to solve this problem please?

LEAVE A REPLY

Please enter your comment!
Please enter your name here