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 system using our guide below.
Step 2: Install Docker Compose on Fedora 36/35/34/33/32
After the Docker Engine has been installed, the next step is the installation of Docker Compose on Fedora 36/35/34/33/32. 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 on Fedora from a binary file.
Please check the latest release of Docker Compose on the Official Compose releases page before downloading.
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.5.1
Method 2: Install Docker Compose on Fedora from OS repo (Not latest package)
With this method you won’t get the latest release of Docker Compose.
If you would like to install the version of Docker Compose available on Fedora upstream repository, just run the command:
sudo dnf install docker-compose
This may not install the most current version of Docker Compose. You can check what is installed using the
$ rpm -qi docker-compose Name : docker-compose Version : 1.29.2 Release : 3.fc35 Architecture: noarch Install Date: Fri 05 Nov 2021 12:10:20 AM EAT Group : Unspecified Size : 905287 License : ASL 2.0 Signature : RSA/SHA256, Sun 25 Jul 2021 08:15:00 PM EAT, Key ID db4639719867c58f Source RPM : docker-compose-1.29.2-3.fc35.src.rpm Build Date : Thu 22 Jul 2021 01:11:04 AM EAT Build Host : buildvm-a64-16.iad2.fedoraproject.org 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
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
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
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
compinit is loaded or do it by adding in
autoload -Uz compinit && compinit -i
Then reload your shell:
exec $SHELL -l
You have learned how to Install Docker Compose on Fedora 36/35/34/33/32. Visit Compose getting started page for how to use Compose.