How to Install Docker on Fedora: A Step-by-Step Guide

Are you looking to install Docker on Fedora? Our comprehensive guide provides clear and concise instructions to get you up and running.

Docker is a popular platform for creating and running software applications in containers, making it easy to package and deploy applications across different environments.

By default, Fedora comes with out-of-the-box support for Podman – a relatively new open-source tool and Docker alternative for developing, managing, and running containers, initially developed by Red Hat.

However, many developers, system administrators, or Linux users interested in containerization prefer sticking to Docker.

If you are one of them and looking for a comprehensive guide on installing Docker on Fedora, this article covers you. By the end of this guide, you’ll be ready to start using Docker to create and deploy containerized applications on your Fedora system. So let’s get started!

Step 1: Update Your Fedora System

Begin by updating the Fedora system OS packages to recent versions. This way, we ensure we have a wholly upgraded system. So, first, run the following command:

sudo dnf updateCode language: Bash (bash)
Update packages on Fedora.
Update packages on Fedora.

As you can see, no updated packages are available, but if you have any, apply them before proceeding.

Step 2: Add Docker Repository

An official Docker repository for RHEL-based Linux systems contains RPM packages for installation. So we must add it to our system before installing Docker on Fedora.

First, install the “dnf-plugins-core” package (if not installed), which provides the commands to manage your DNF repositories.

 sudo dnf install dnf-plugins-coreCode language: Bash (bash)

Then, add the official Docker repository to your Fedora system. This implies that the update package will be made available with the rest of your system’s regular updates if a new version is released.

sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repoCode language: Bash (bash)
Add the official Docker repository to Fedora.
Add the official Docker repository to Fedora.

Step 3: Installing Docker on Fedora

Now that we’ve already had the Docker repository added to the system, we can install Docker, along with its command-line tool and containerd.io, to manage the container lifecycle of its host system more efficiently.

The command below will install your Fedora system’s most up-to-date Docker version.

sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginCode language: Bash (bash)
Installing Docker on Fedora.
Installing Docker on Fedora.

You’ll be prompted to accept the GPG key during the installation, so type “Y” and hit “Enter” to proceed.

Import the repo’s GPG key.
Import the repo’s GPG key.

Wait for the confirmation message for the successful completion of the Docker installation on your Fedora Linux system.

Step 4: Enable and Start the Docker Service

After the installation is complete, you can launch the Docker service and configure it to start automatically when the system boots:

sudo systemctl start docker
sudo systemctl enable dockerCode language: Bash (bash)
Start and enable autostart on service on boot.
Start and enable autostart on service on boot.

Finally, to confirm the running status of the Docker service, issue the following command:

sudo systemctl is-active dockerCode language: Bash (bash)
Check service status.
Check service status.

As you can see, Docker is up and running as expected.

Step 5: Manage Docker with a Non-Root User

So far, we have successfully installed Docker on our Fedora Linux system. However, only root and users with sudo privileges can execute Docker commands by default.

So, if you now attempt to run the docker command without prefixing it with sudo, you’ll get an output like this:

Trying to run the docker command as a regular user.
Trying to run the docker command as a regular user.

But don’t be concerned. There’s a simple solution. To run Docker commands as a non-root user, add your user to the “docker” group. To do that, type in the following:

sudo usermod -aG docker ${USER}Code language: Bash (bash)

In the above command, ${USER} is an environment variable that holds your username. To apply for the new group membership, reboot your Fedora system. You can then execute docker commands without prefixing them with sudo.

Run the docker command as a regular user.
Run the docker command as a regular user.

This approach can reduce the security risks associated with Docker while enabling non-root users to take advantage of its powerful capabilities.

Step 6: Test the Docker Installation on Fedora

Now let’s check if everything with our new Docker installation works properly. For this purpose, we will run a simple application called “hello-world.”

docker run hello-worldCode language: Bash (bash)
Docker successfully installed, up & running on Fedora Linux.
Docker successfully installed, up & running on Fedora Linux.

Congratulations! As we can see, everything works as expected!

Conclusion

Installing Docker on Fedora is a simple process that can be accomplished by following a few easy steps. Following the steps outlined in this guide, you can quickly set up Docker on your Fedora machine and begin deploying and managing containers.

To learn more about Docker, check out the official Docker documentation. Additionally, I recommend you check out our detailed guide to expand your skills with Docker and learn how to run and manage multi-container applications using Docker Compose.

Let me know if you have any questions or suggestions, and I’ll be happy to follow up with you. Happy dockering!

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Think You're an Ubuntu Expert? Let's Find Out!

Put your knowledge to the test in our lightning-fast Ubuntu quiz!
Ten questions to challenge yourself to see if you're a Linux legend or just a penguin in the making.

1 / 10

Ubuntu is an ancient African word that means:

2 / 10

Who is the Ubuntu's founder?

3 / 10

What year was the first official Ubuntu release?

4 / 10

What does the Ubuntu logo symbolize?

5 / 10

What package format does Ubuntu use for installing software?

6 / 10

When are Ubuntu's LTS versions released?

7 / 10

What is Unity?

8 / 10

What are Ubuntu versions named after?

9 / 10

What's Ubuntu Core?

10 / 10

Which Ubuntu version is Snap introduced?

The average score is 68%