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

Listen to this article

Looking to install Docker on Fedora? Docker simplifies application deployment by using containers. Follow this optimized guide to set up Docker effortlessly on your Fedora system.

What is Docker?

Docker is an open-source platform that allows developers to automate the deployment, scaling, and management of applications using containerization. Containers are lightweight, portable units that package an application along with all its dependencies, libraries, and configuration files, ensuring that the application runs consistently across various environments.

Unlike virtual machines, containers share the host system’s operating system, making them faster to start and more resource efficient. Docker simplifies the development workflow, enhances application isolation, and enables seamless deployment across cloud, on-premises, and hybrid infrastructures.

Steps before Installing Docker.

Step 1: Update Your Fedora System

Keeping your system updated ensures compatibility and security. Run the following command in your terminal:

sudo dnf update -y

This updates all installed packages to their latest versions

Step 2: Removing older version (if installed)

If you have an older version of Docker, you may want to remove it to prevent package conflict. This reduces chances of installation errors.

To do this, run the command below.

sudo dnf remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

Install Docker

Step 3: Install dnf-plugins-core

Ensure the dnf-plugins-core package is installed:

sudo dnf -y install dnf-plugins-core

Step 4: Add repository to the local package manager

Docker is not included in Fedora’s default repositories. To access it, enable Docker’s official repository:

sudo dnf-3 config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repoCode language: JavaScript (javascript)

Step 5: Install Docker Engine

sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginCode language: CSS (css)

Steps to make Docker run rootless

Run all these steps to get Docker running rootless.

sudo modprobe ip_tables

Run this shell script that ships with the Docker installation to make Docker run rootless.

dockerd-rootless-setuptool.sh installCode language: CSS (css)

Time to do a test run with Docker

docker run hello-world

If this runs without any error, we got Docker up and running rootlessly.

That’s it folks, now go be a pirate and ship containers!