Docker Compose is a powerful tool for defining and managing multi-container Docker applications. It uses a YAML configuration file commonly known as the Compose file – to specify your application’s services, networks, and volumes. With Docker Compose, you can spin up all the defined services using a single command, streamlining what would otherwise require multiple individual docker commands.

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.36.1

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

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:

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