15. March 2022

Install Docker on CentOS Stream 8

By H. Cemre Günay

In this Tutorial I will show you how to install Docker on CentOS Stream 8.

Docker is a popular open source tool that provides a portable and consistent runtime environment for software applications. Docker uses containers as isolated environments in user space that run at the operating system level and share the file system and system resources.

There are two editions of Docker available.

  • Community Edition (CE): ideal for individual developers and small teams looking to get started with Docker and experimenting with container-based apps.
  • Enterprise Edition (EE): Designed for enterprise development and IT teams who build, ship, and run business-critical applications in production at scale.

In this guide, we will install Docker CE on CentOS Stream 8. Please don’t forget, if you are root, you will not need to use sudo in your commands:

Step 1: Let’s add Docker repository before we can install it.

### CentOS 8 ###
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

This command will download Docker repository file to /etc/yum.repos.de/docker-ce.repo

Step 2: Let’s update RPM index cache.

### CentOS 8 ###
$ sudo yum makecache 
CentOS Stream 8 - AppStream                                 8.6 kB/s | 4.4 kB     00:00
CentOS Stream 8 - BaseOS                                     11 kB/s | 3.9 kB     00:00
CentOS Stream 8 - Extras                                    4.2 kB/s | 3.0 kB     00:00
Docker CE Stable - x86_64                                   106 kB/s |  19 kB     00:00
Metadata cache created.

Step 3: You may need to uninstall all older versions of Docker along with associated dependencies. Also uninstall Podman and the associated dependencies if installed already.

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine \
                  podman \
                  runc

Step 4: Finally install Docker CE by running the command below in your terminal.

sudo yum install docker-ce docker-ce-cli containerd.io

(Optional) If you get dependency issues with Podman allow errasing.

sudo yum install docker-ce --allowerasing

Agree to install by hitting the key in your keyboard.

Step 5: Start and enable Docker Service to start at boot.

sudo systemctl enable --now docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.

The docker service status should indicate running.

sudo 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 Mon 2022-02-21 11:33:36 EST; 1min 13s ago
     Docs: https://docs.docker.com
 Main PID: 32972 (dockerd)
    Tasks: 9
   Memory: 33.5M
   CGroup: /system.slice/docker.service
           └─32972 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.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 $USER
newgrp docker
id $USER
uid=0(root) gid=0(root) groups=0(root),985(docker)

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

docker version
Client: Docker Engine - Community
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.16.12
 Git commit:        e91ed57
 Built:             Mon Dec 13 11:45:22 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.12
  Git commit:       459d0df
  Built:            Mon Dec 13 11:43:44 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

And that’s it, if you have any questions, please leave it in the comments. Source of this Tutorial: https://computingforgeeks.com/install-docker-and-docker-compose-on-rhel-8-centos-8/, tested by me and if you are interested on how to install Docker Compose please visit my other post: