skip to Main Content
Install Docker Compose Fedora 32

Install Docker Compose Fedora 32

Docker gives you the option of installing it in several ways. Choosing from Docker’s repositories, RPM packages, and convenience scripts. The official Docker documentation describes all those options up to Fedora’s version 31. But for version 32 there are none. This guide describes step-by-step, how to install Docker Compose on Fedora 32. Including all encountered errors and how to correct them.

Installing Docker from convenience script

Get the Docker script from the official Docker site by running curl from your terminal.

Now run the script with elevated privileges.

As you can see in the marked lines the script fails with the following error messages:
  • Errors during downloading metadata for repository ‘docker-ce-stable’:
  • Status code: 404 for https://download.docker.com/linux/fedora/32/x86_64/stable/repodata/repomd.xml
  • Error: Failed to download metadata for repo ‘docker-ce-stable’: Cannot download repomd.xml
Let’s take a closer look at why this happens.

Cannot download repodata

The 404 error message seems to be correct when you open up the URL from a web browser.

fedora 32 docker repomd nosuchkey the specified key does not exist.

Parent folder repodata is missing as well. This continues to be the case up to the index of linux/fedora = https://download.docker.com/linux/fedora. Where it becomes clear that the 32 repository doesn’t even exist.

fedora 32 docker repository missing

While reading through official Docker documentation on installing Docker using the convenience script. There is no mention of Fedora 32 in the OS requirements either.

docker engine no fedora 32

Clean up the script

Since the installation failed let’s clean-up the cached packages and repository data.

This doesn’t seem to fix the issue when you run dnf update again. The error still persists.

The error message persists even after removing the contents of the cache directory.

Let’s think for a moment. The error message states that it can’t find the metadata from the repository added by the script. So, let’s go find and remove this repository.

Find the faulty repo

List all the repositories by running the following command:

The highlighted repository is the one we’re looking for. Now remove it by running the following command.

Check if the update completes without errors

Update again to check if this solved our issue by running the following command:

Update completed without any error messages. Now we can finally get started with getting Docker to work on Fedora 32.

Install Docker from DNF

Another method that seems to do the trick is to install Docker from dnf by running the following command:

The installation completed without any error messages. Confirm the installation of Docker by running the following command:

Add your user to the Docker group if you don’t want to run the Docker commands as a sudo user all the time.

Enable the Docker service to run on boot.

Start the Docker service.

Install Docker Compose

After installing Docker it’s time to install Compose as well. At the moment of writing the current stable release is 1.25.5. You can always check for the latest version on Docker or Github.

Apply executable permissions to the binary by running the following command:

No error messages here as well. Confirm the installation of Docker Compose by running the following command:

Create a Docker Compose file

Now, let’s create a directory and a configuration file for our Docker Compose setup.

The configuration file will consist of the official WordPress and MySQL configuration. Use your editor of choice or copy and paste the code from below to your terminal.

Building the Docker Images

Now that Docker and Compose are both installed. Let’s build our images by running the docker-compose file.

The system wasn’t restarted up to this point for the new permissions to become active. Run the Docker-Compose file with sudo permissions for now.

The Docker-Compose script fails with the highlighted above error messages:

After extensive application of Google-fu. The answer has presented itself in the following form.

To overcome this you’d have to switch the system to using cgroups v1 by running the following command:

Reboot the system after updating the kernel.

Running the Docker-Compose script after the reboot should finish building the images.

No connection between the containers

The last thing which remains now is starting up WordPress on the port configured in the YAML file.

fedora 32 docker compose wordpress error establishing connection

It looks like WordPress is running. But it’s not able to communicate with the database. Which results in: ‘Error establishing a database connection‘.

Running apt update from the container itself only confirms the lack of connectivity.

As mentioned in this Github post. The networking issues are due to firewalld switching from iptables to nftables.

Configure Firewalld

By running sudo ls -l on the /etc/firewalld directory. We can actually see that firewalld.conf is a symbolic link. Pointing to firewalld-workstation.conf.

You can set the value of the config file to iptables by running the following command:

Or look for the following line ‘FirewallBackend=nftables‘ with your editor of choice. Replace it with ‘FirewallBackend=iptables‘.

fedora 32 docker firewalld iptables

Restart the firewalld.service so you don’t have to reboot the system again.

You are now presented with the WordPress installer when you open up WordPress again.

fedora 32 docker compose wordpress

The WordPress container is now also able to run the apt update.

Take me to the solution

If you only need the solution follow these steps.

Or run this script for convenience

For convenience, the following script takes care of all the steps written in our guide. Save it as a shell file and run it from your terminal with elevated privileges. A quick preview on how it works.

 

Reboot your system after running the script. Then run the Docker-Compose script from the terminal by running: docker-compose -f /opt/docker/docker-compose.yml up -d

If you stayed with us up to this point, then you already know how to install Docker Compose on Fedora 32. If you also would like to know how to increase the maximal upload size of WordPress in Docker you can read it over here.

TechGuideReview

TechGuideReview

Information Technology passionate. Founder of the TechGuideReview blog.

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top