Install Docker CE on Fedora 36/35/34/33/32/31

Posted on 200 views

Welcome to our guide on how to install Docker CE on Fedora 36/35/34/33/32/31 Linux distribution. The release of Docker we’ll install is Docker Community Edition (CE). Docker is a leading container runtime engine that allows you to package your applications with all of its dependencies into a standardized unit for software development.

Follow the steps below to install Docker CE on Fedora 36/35/34/33/32/31 Linux system.

Step 1: Update your system

Before we install Docker on Fedora 36/35/34/33/32/31 Linux machine, we’ll start our installations by updating and upgrading OS packages. On Fedora, this can be easily done by running the command:

sudo dnf -y update

It is recommended to reboot your system after an upgrade

sudo reboot

Step 2: Add Docker CE repository on Fedora 36/35/34/33/32

After upgrading system packages and rebooting the server, proceed to add Fedora repository to your system:

sudo dnf -y install dnf-plugins-core

Fedora 36:

sudo tee /etc/yum.repos.d/docker-ce.repo<

Fedora 35:

sudo tee /etc/yum.repos.d/docker-ce.repo<

Fedora 34:

sudo tee /etc/yum.repos.d/docker-ce.repo<

Fedora 33:

sudo tee /etc/yum.repos.d/docker-ce.repo<

Fedora 32:

sudo tee /etc/yum.repos.d/docker-ce.repo<

Fedora 31:

sudo tee /etc/yum.repos.d/docker-ce.repo<

Step 3: Install Docker CE on Fedora 36/35/34/33/32/31

Now that you have your repository ready, install the latest stable release of Docker CE on your machine by running:

sudo dnf makecache
sudo dnf install docker-ce docker-ce-cli containerd.io

Press the key when prompted to start the installation.

Dependencies resolved.
======================================================================================================================================================================================================
 Package                                                 Architecture                         Version                                            Repository                                      Size
======================================================================================================================================================================================================
Installing:
 containerd.io                                           x86_64                               1.6.4-3.1.fc36                                     docker-ce-stable                                32 M
 docker-ce                                               x86_64                               3:20.10.16-3.fc36                                  docker-ce-stable                                22 M
 docker-ce-cli                                           x86_64                               1:20.10.16-3.fc36                                  docker-ce-stable                                29 M
Installing dependencies:
 docker-ce-rootless-extras                               x86_64                               20.10.16-3.fc36                                    docker-ce-stable                               3.8 M
 libcgroup                                               x86_64                               2.0-4.fc36                                         fedora                                          73 k
Installing weak dependencies:
 docker-scan-plugin                                      x86_64                               0.17.0-3.fc36                                      docker-ce-stable                               3.6 M

Transaction Summary
======================================================================================================================================================================================================
Install  6 Packages

Total download size: 91 M
Installed size: 388 M
Is this ok [y/N]: y

And accept to import GPG key:

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                  57 MB/s |  91 MB     00:01
Docker CE Stable - x86_64                                                                                                                                              19 kB/s | 1.6 kB     00:00
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) "
 Fingerprint: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
 From       : https://download.docker.com/linux/fedora/gpg
Is this ok [y/N]: y

Docker will be installed but not started. To start the docker service, run:

sudo systemctl enable --now docker

You can check status with:

$ systemctl status docker
 docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
     Active: active (running) since Wed 2022-05-18 14:39:08 EAT; 5s ago
TriggeredBy:  docker.socket
       Docs: https://docs.docker.com
   Main PID: 1574 (dockerd)
      Tasks: 8
     Memory: 31.4M
        CPU: 154ms
     CGroup: /system.slice/docker.service
             └─1574 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

May 18 14:39:07 fedora dockerd[1574]: time="2022-05-18T14:39:07.934012002+03:00" level=info msg="ccResolverWrapper: sending update to cc: {[unix:///run/containerd/containerd.sock   0 ] >
May 18 14:39:07 fedora dockerd[1574]: time="2022-05-18T14:39:07.934090843+03:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
May 18 14:39:07 fedora dockerd[1574]: time="2022-05-18T14:39:07.966105103+03:00" level=info msg="Loading containers: start."
May 18 14:39:08 fedora dockerd[1574]: time="2022-05-18T14:39:08.345694212+03:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be us>
May 18 14:39:08 fedora dockerd[1574]: time="2022-05-18T14:39:08.418292633+03:00" level=info msg="Firewalld: interface docker0 already part of docker zone, returning"
May 18 14:39:08 fedora dockerd[1574]: time="2022-05-18T14:39:08.509642310+03:00" level=info msg="Loading containers: done."
May 18 14:39:08 fedora dockerd[1574]: time="2022-05-18T14:39:08.517873559+03:00" level=info msg="Docker daemon" commit=f756502 graphdriver(s)=btrfs version=20.10.16
May 18 14:39:08 fedora dockerd[1574]: time="2022-05-18T14:39:08.518183882+03:00" level=info msg="Daemon has completed initialization"
May 18 14:39:08 fedora systemd[1]: Started docker.service - Docker Application Container Engine.
May 18 14:39:08 fedora dockerd[1574]: time="2022-05-18T14:39:08.558121459+03:00" level=info msg="API listen on /run/docker.sock"

The docker group is created, but no users are added to the group. Add your user to this group to run docker commands without sudo.

sudo usermod -aG docker $(whoami)
newgrp docker

Logout and Login again to use Docker without sudo. The version of Docker installed can be checked with:

$ docker version
[[email protected] ~]$ docker version
Client: Docker Engine - Community
 Version:           20.10.16
 API version:       1.41
 Go version:        go1.17.10
 Git commit:        aa7e414
 Built:             Thu May 12 09:16:46 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.16
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.10
  Git commit:       f756502
  Built:            Thu May 12 09:14:29 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.4
  GitCommit:        212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
 runc:
  Version:          1.1.1
  GitCommit:        v1.1.1-0-g52de29d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

This shows both Client and Engine versions.

Step 4: Pull Test docker image

The last step is to test your installation by downloading a test docker container.

$ docker pull alpine
Using default tag: latest
latest: Pulling from library/alpine
df9b9388f04a: Pull complete
Digest: sha256:4edbd2beb5f78b1014028f4fbb99f3237d9561100b6881aabbf5acce2c4f9454
Status: Downloaded newer image for alpine:latest
docker.io/library/alpine:latest

Verify that Docker CE is installed correctly by running the alpine image.

$ docker run -it --rm alpine /bin/sh
/ # apk update
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
v3.15.4-150-g2cac749901 [https://dl-cdn.alpinelinux.org/alpine/v3.15/main]
v3.15.4-149-g06cc714d68 [https://dl-cdn.alpinelinux.org/alpine/v3.15/community]
OK: 15857 distinct packages available
/ # exit

That’s all. You now have Docker running on your Fedora system. The next reading is:

To setup a Docker registry, check our guide on how to:

Please check our guide on managing Docker containers through a web interface:

For easy monitoring, you can use:

For installation of Docker on other systems, use:

Don’t forget to check other Fedora articles available on our website.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.