How to install and configure docker In Fedora 34/35

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. 

Docker is an open source containerization platform. It enables developers to package applications into containers—standardized executable components combining application source code with the operating system (OS) libraries and dependencies required to run that code in any environment.

In this guide we are going to explore various options to install docker in Fedora 34

Also check

# Prerequisites

To install Docker Engine, you need to have the following

  • Updated Fedora 34 server
  • Internet connection
  • Basic knowledge of linux terminal

# Table of Content

  • Update system packages
  • Uninstall old versions
  • Installing docker
  • Starting and enabling Docker
  • Uninstalling Docker

# Updating system packages

Before proceeding let’s ensure that our system is up to date. Use this command to update the system and all the packages

sudo dnf -y update

# Uninstall old versions

If older versions of docker are installed in the system, uninstall them, along with associated dependencies.

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

It’s OK if dnf reports that none of these packages are installed.

The contents of /var/lib/docker/, including images, containers, volumes, and networks, are preserved. The Docker Engine package is now called docker-ce.

# Installing docker

There are multiple ways of installing docker in Fedora 34. You can:

  • Set up docker repositories. This is recommended as you can even upgrade docker once set up
  • Download rpm and install manually
  • You can choose an automated convenience scripts to install Docker

# Install using the repository

Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.

Install the dnf-plugins-core package (which provides the commands to manage your DNF repositories) and set up the stable repository.

 sudo dnf -y install dnf-plugins-core
 sudo dnf config-manager \
    --add-repo \

To install the latest version of Docker Engine and containerd:

sudo dnf install docker-ce docker-ce-cli -y

This command installs Docker, but it doesn’t start Docker. It also creates a docker group, however, it doesn’t add any users to the group by default.

To install a specific version of Docker Engine, list the available versions in the repo, then select and install:

a. List and sort the versions available in your repo. This example sorts results by version number, highest to lowest, and is truncated:

$ sudo dnf list docker-ce  --showduplicates | sort -r
Last metadata expiration check: 0:00:44 ago on Fri 29 Oct 2021 06:11:19 AM UTC.
Installed Packages
docker-ce.x86_64               3:20.10.9-3.fc34                docker-ce-stable
docker-ce.x86_64               3:20.10.8-3.fc34                docker-ce-stable
docker-ce.x86_64               3:20.10.7-3.fc34                docker-ce-stable
docker-ce.x86_64               3:20.10.6-3.fc34                docker-ce-stable
docker-ce.x86_64               3:20.10.10-3.fc34               docker-ce-stable
docker-ce.x86_64               3:20.10.10-3.fc34               @docker-ce-stable
Available Packages

The above command will list packages based on which repositories are enabled.

Install a specific version by its fully qualified package name, which is the package name (docker-ce) plus the version string (2nd column) starting at the first colon (:), up to the first hyphen, separated by a hyphen (-). For example3:20.10.7.

sudo dnf install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING>

# Install using a package

If for any reason you can not use docker’s repository for the installation, you can download an rpm package and install manually.

Go to and choose your version of Fedora. Then browse to x86_64/stable/Packages/ and download the .rpm file for the Docker version you want to install

Install Docker Engine, changing the path below to the path where you downloaded the Docker package.

sudo dnf install /path/to/package.rpm

Docker is installed but not started. The docker group is created, but no users are added to the group.

# Install using the convenience script

Docker provides a convenience script at to install Docker into development environments quickly and non-interactively. The convenience script is not recommended for production environments, but can be used as an example to create a provisioning script that is tailored to your needs. 

The script requires root or sudo privileges to run. The script attempts to detect your Linux distribution and version and configure your package management system for you, and does not allow you to customize most installation parameters. The script installs dependencies and recommendations without asking for confirmation. By default, the script installs the latest stable release of Docker, containerd, and runc.

You can run the script with the DRY_RUN=1 option to learn what steps the script will execute during installation:

$ curl -fsSL -o
$ DRY_RUN=1 sh ./

This downloads the script from and runs it to install the latest stable release of Docker on Linux:

curl -fsSL -o
sudo sh

# Starting and enabling docker

On RPM based distributions, such as Fedora, CentOS, RHEL or SLES, you need to start it manually using the appropriate systemctl or service command. Non-root users cannot run Docker commands by default.

Use this command to start docker

sudo systemctl start docker

Confirm that docker is running by issuing the status command

$ sudo systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
     Active: active (running) since Fri 2021-10-29 06:12:55 UTC; 13s ago
TriggeredBy: ● docker.socket
   Main PID: 40914 (dockerd)
      Tasks: 8
     Memory: 27.5M
        CPU: 282ms
     CGroup: /system.slice/docker.service
             └─40914 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Oct 29 06:12:54 new-cloud dockerd[40914]: time="2021-10-29T06:12:54.904547751Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Oct 29 06:12:54 new-cloud dockerd[40914]: time="2021-10-29T06:12:54.904696516Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock  <nil> 0 <nil>}] >
Oct 29 06:12:54 new-cloud dockerd[40914]: time="2021-10-29T06:12:54.904790830Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Oct 29 06:12:54 new-cloud dockerd[40914]: time="2021-10-29T06:12:54.970510621Z" level=info msg="Loading containers: start."
Oct 29 06:12:55 new-cloud dockerd[40914]: time="2021-10-29T06:12:55.137754179Z" level=info msg="Default bridge (docker0) is assigned with an IP address Daemon option --bip can be us>
Oct 29 06:12:55 new-cloud dockerd[40914]: time="2021-10-29T06:12:55.221701113Z" level=info msg="Loading containers: done."
Oct 29 06:12:55 new-cloud dockerd[40914]: time="2021-10-29T06:12:55.284536368Z" level=info msg="Docker daemon" commit=e2f740d graphdriver(s)=overlay2 version=20.10.10
Oct 29 06:12:55 new-cloud dockerd[40914]: time="2021-10-29T06:12:55.284791294Z" level=info msg="Daemon has completed initialization"
Oct 29 06:12:55 new-cloud systemd[1]: Started Docker Application Container Engine.
Oct 29 06:12:55 new-cloud dockerd[40914]: time="2021-10-29T06:12:55.320690806Z" level=info msg="API listen on /run/docker.sock"

To enable docker on boot, use this command:

sudo systemctl enable docker

Docker will not work for no-root users or without sudo, you will get the error below if you attempt.

$ docker ps
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json": dial unix /var/run/docker.sock: connect: permission denied

To use docker without Sudo, add the current user to the docker group then re-login.

Add the user to the docker group:

$ sudo usermod -aG docker ${USER}

Then relogin as the user

$ sudo su - ${USER}

Then check that you are now part of docker

$ id
uid=1000(fedora) gid=1000(fedora) groups=1000(fedora),4(adm),10(wheel),190(systemd-journal),989(docker) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

Now we can confirm that everything is working by issuing the docker run command for the hello-world image:

$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:37a0b92b08d4919615c3ee023f7ddb068d12b8387475d64c622ac30f45c29c51
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

# Uninstalling Docker

If you no longer need docker in the system, use these commands to uninstall it

sudo dnf remove docker-ce docker-ce-cli
  1. Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

You must delete any edited configuration files manually.

# Conclusion

We have managed to install docker on a Fedora 34 system either using the repository or downloading an rpm then installing it or using a convenience script.

comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy