How To Install Docker On CentOS 7

How to install Docker on CentOS 7

In this short tutorial, we will learn how to install Docker Community Edition version 20.10.17 on CentOS 7 operating system, we will install Docker by using the Docker’s repositories.


Docker is an open source technology which manages and automates application deployment by using containers. Containers are created and distributed via images that contain anything to run the application, all dependencies are handled on containers. Docker is preferred by developers, because of the ease of building an application. Docker speeds up applications, since it shares the kernel and other Linux resources. On this short tutorial we will learn how to install Docker  on CentOS 7 operating system.

Docker Installation On CentOS 7

There are three types Docker installation methods, namely :

1. Install using the convenience script
2. Install from a package
3. Install using the repository

On this short tutorial we will install the latest version of Docker Community Edition by using Docker’s repository.

Install Docker Using Repository

The installation of Docker Community Edition using repository will be consist of several steps as described below:

  1. Set up the repository
  2. Install Docker Engine
    • Install  Spesicif version
    • Install The latest version
  3. Start Docker
  4. Verify Docker

1. Set up Docker Repository

On this stage, we will install yum-utils package which provides the yum-config-manager utility. This task is performed by submitting command line :

$ sudo yum install -y yum-utils

The output :

[ramansah@dev01 ~]$ sudo yum install -y yum-utils
Loaded plugins: fastestmirror, langpacks
Existing lock /var/run/ another copy is running as pid 3343.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: PackageKit
Memory : 51 M RSS (471 MB VSZ)
Started: Wed Aug 3 20:52:35 2022 - 00:05 ago
State : Sleeping, pid: 3343
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: PackageKit
Memory : 51 M RSS (471 MB VSZ)
Started: Wed Aug 3 20:52:35 2022 - 00:07 ago
State : Sleeping, pid: 3343
Loading mirror speeds from cached hostfile
* base:
* extras:
* updates:
base | 3.6 kB 00:00:00 
extras | 2.9 kB 00:00:00 
updates | 2.9 kB 00:00:00 
updates/7/x86_64/primary_db | 16 MB 00:00:14 
Package yum-utils-1.1.31-54.el7_8.noarch already installed and latest version
Nothing to do

After it was done, then we will set up the Docker repository by submitting command line :

$ sudo yum-config-manager --add-repo

The output :

[ramansah@dev01 ~]$ sudo yum-config-manager --add-repo
Loaded plugins: fastestmirror, langpacks
adding repo from:
grabbing file to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo

2. Install Docker Community Edition Engine

At this stage we will install Docker engine. There are two installation option, namely : install the latest version of Docker and install spesific version of Docker.

2.1. Install Specific Version of Docker

To install the specific version of Docker we have to list and sort the versions available in our repo. To perform this task we have to submit the command line :

$ yum list docker-ce --showduplicates | sort -r

The output will be :

[ramansah@dev01 ~]$ yum list docker-ce --showduplicates | sort -r
* updates:
Loaded plugins: fastestmirror, langpacks
* extras:
docker-ce.x86_64 3:20.10.9-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.8-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.7-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.6-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.5-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.4-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.3-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.2-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.17-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.16-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.15-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.14-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.13-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.12-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.11-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.10-3.el7 docker-ce-stable
docker-ce.x86_64 3:20.10.0-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.9-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.8-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.7-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.6-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.5-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.4-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.3-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.2-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.15-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.14-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.13-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.12-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.11-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.10-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.0-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.9-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.8-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.7-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.6-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.5-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.4-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.3-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.2-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.3.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.2.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 18.03.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.3.ce-1.el7 docker-ce-stable
docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
Determining fastest mirrors
* base:
Available Packages

Then we will install a chosen version by submitting command line :

sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> docker-compose-plugin

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 (-).

2.2. Install The Latest Version of Docker

To install Install the latest version of Docker Engine, we will submit the following command line :

$ sudo yum install docker-ce docker-ce-cli docker-compose-plugin

The output :

ramansah@dev01 ~]$ sudo yum install docker-ce docker-ce-cli docker-compose-plugin
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base:
* extras:
* updates:
Resolving Dependencies
--> Running transaction check
---> Package 0:1.6.6-3.1.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package:
---> Package docker-ce.x86_64 3:20.10.17-3.el7 will be installed
--> Processing Dependency: docker-ce-rootless-extras for package: 3:docker-ce-20.10.17-3.el7.x86_64
---> Package docker-ce-cli.x86_64 1:20.10.17-3.el7 will be installed
--> Processing Dependency: docker-scan-plugin(x86-64) for package: 1:docker-ce-cli-20.10.17-3.el7.x86_64
---> Package docker-compose-plugin.x86_64 0:2.6.0-3.el7 will be installed
--> Running transaction check
---> Package container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installed
---> Package docker-ce-rootless-extras.x86_64 0:20.10.17-3.el7 will be installed
--> Processing Dependency: fuse-overlayfs >= 0.7 for package: docker-ce-rootless-extras-20.10.17-3.el7.x86_64
--> Processing Dependency: slirp4netns >= 0.4 for package: docker-ce-rootless-extras-20.10.17-3.el7.x86_64
---> Package docker-scan-plugin.x86_64 0:0.17.0-3.el7 will be installed
--> Running transaction check
---> Package fuse-overlayfs.x86_64 0:0.7.2-6.el7_8 will be installed
--> Processing Dependency: for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
--> Processing Dependency: for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
--> Processing Dependency: for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
---> Package slirp4netns.x86_64 0:0.4.3-4.el7_8 will be installed
--> Running transaction check
---> Package fuse3-libs.x86_64 0:3.6.1-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

Package Arch Version Repository Size
Installing: x86_64 1.6.6-3.1.el7 docker-ce-stable 33 M
docker-ce x86_64 3:20.10.17-3.el7 docker-ce-stable 22 M
docker-ce-cli x86_64 1:20.10.17-3.el7 docker-ce-stable 29 M
docker-compose-plugin x86_64 2.6.0-3.el7 docker-ce-stable 7.0 M
Installing for dependencies:
container-selinux noarch 2:2.119.2-1.911c772.el7_8 extras 40 k
docker-ce-rootless-extras x86_64 20.10.17-3.el7 docker-ce-stable 8.2 M
docker-scan-plugin x86_64 0.17.0-3.el7 docker-ce-stable 3.7 M
fuse-overlayfs x86_64 0.7.2-6.el7_8 extras 54 k
fuse3-libs x86_64 3.6.1-4.el7 extras 82 k
slirp4netns x86_64 0.4.3-4.el7_8 extras 81 k

Transaction Summary
Install 4 Packages (+6 Dependent packages)

Total download size: 104 M
Installed size: 419 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for extras
No Presto metadata available for docker-ce-stable
warning: /var/cache/yum/x86_64/7/extras/packages/container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm is not installed
(1/10): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm | 40 kB 00:00:01
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-20.10.17-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Public key for docker-ce-20.10.17-3.el7.x86_64.rpm is not installed
(2/10): docker-ce-20.10.17-3.el7.x86_64.rpm | 22 MB 00:00:30
(3/10): | 33 MB 00:00:40
(4/10): docker-ce-rootless-extras-20.10.17-3.el7.x86_64.rpm | 8.2 MB 00:00:11
(5/10): docker-compose-plugin-2.6.0-3.el7.x86_64.rpm | 7.0 MB 00:00:10
(6/10): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm | 54 kB 00:00:00
(7/10): fuse3-libs-3.6.1-4.el7.x86_64.rpm | 82 kB 00:00:01
(8/10): slirp4netns-0.4.3-4.el7_8.x86_64.rpm | 81 kB 00:00:01
(9/10): docker-scan-plugin-0.17.0-3.el7.x86_64.rpm | 3.7 MB 00:00:05
(10/10): docker-ce-cli-20.10.17-3.el7.x86_64.rpm | 29 MB 00:00:36
Total 1.5 MB/s | 104 MB 00:01:07
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-9.2009.0.el7.centos.x86_64 (@anaconda)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Is this ok [y/N]: y
Retrieving key from
Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm) <>"
Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
From :
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : docker-scan-plugin-0.17.0-3.el7.x86_64 1/10
Installing : 1:docker-ce-cli-20.10.17-3.el7.x86_64 2/10
Installing : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 3/10
Installing : 4/10
Installing : slirp4netns-0.4.3-4.el7_8.x86_64 5/10
Installing : fuse3-libs-3.6.1-4.el7.x86_64 6/10
Installing : fuse-overlayfs-0.7.2-6.el7_8.x86_64 7/10
Installing : 3:docker-ce-20.10.17-3.el7.x86_64 8/10
Installing : docker-ce-rootless-extras-20.10.17-3.el7.x86_64 9/10
Installing : docker-compose-plugin-2.6.0-3.el7.x86_64 10/10
Verifying : fuse3-libs-3.6.1-4.el7.x86_64 1/10
Verifying : 2/10
Verifying : docker-ce-rootless-extras-20.10.17-3.el7.x86_64 3/10
Verifying : 1:docker-ce-cli-20.10.17-3.el7.x86_64 4/10
Verifying : slirp4netns-0.4.3-4.el7_8.x86_64 5/10
Verifying : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 6/10
Verifying : 3:docker-ce-20.10.17-3.el7.x86_64 7/10
Verifying : docker-scan-plugin-0.17.0-3.el7.x86_64 8/10
Verifying : fuse-overlayfs-0.7.2-6.el7_8.x86_64 9/10
Verifying : docker-compose-plugin-2.6.0-3.el7.x86_64 10/10

Installed: 0:1.6.6-3.1.el7 docker-ce.x86_64 3:20.10.17-3.el7
docker-ce-cli.x86_64 1:20.10.17-3.el7 docker-compose-plugin.x86_64 0:2.6.0-3.el7

Dependency Installed:
container-selinux.noarch 2:2.119.2-1.911c772.el7_8 docker-ce-rootless-extras.x86_64 0:20.10.17-3.el7
docker-scan-plugin.x86_64 0:0.17.0-3.el7 fuse-overlayfs.x86_64 0:0.7.2-6.el7_8
fuse3-libs.x86_64 0:3.6.1-4.el7 slirp4netns.x86_64 0:0.4.3-4.el7_8


Until this step, we have installed Docker version 20 on CentOS 7 successfully.

3. Starting Docker

On this stage we will start Docker service to run properly on the system. For this purpose we will submit command line :

$ sudo systemctl start docker

Then show the status by submitting command line :

$ sudo systemctl status docker

The output :

[ramansah@dev01 ~]$ sudo systemctl start docker
[sudo] password for ramansah: 
[ramansah@dev01 ~]$ 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 Wed 2022-08-03 22:10:56 WIB; 16s ago
Main PID: 4950 (dockerd)
Tasks: 8
Memory: 40.8M
CGroup: /system.slice/docker.service
└─4950 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Aug 03 22:10:55 dockerd[4950]: time="2022-08-03T22:10:55.393488162+07:00" level=i...rpc
Aug 03 22:10:55 dockerd[4950]: time="2022-08-03T22:10:55.393511357+07:00" level=i...rpc
Aug 03 22:10:55 dockerd[4950]: time="2022-08-03T22:10:55.425938991+07:00" level=i...t."
Aug 03 22:10:56 dockerd[4950]: time="2022-08-03T22:10:56.211817789+07:00""
Aug 03 22:10:56 dockerd[4950]: time="2022-08-03T22:10:56.337831673+07:00""
Aug 03 22:10:56 dockerd[4950]: time="2022-08-03T22:10:56.434096583+07:00" level=i...e."
Aug 03 22:10:56 dockerd[4950]: time="2022-08-03T22:10:56.467253922+07:00" level=i....17
Aug 03 22:10:56 dockerd[4950]: time="2022-08-03T22:10:56.467876411+07:00" level=i...on"
Aug 03 22:10:56 systemd[1]: Started Docker Application Container Engine.
Aug 03 22:10:56 dockerd[4950]: time="2022-08-03T22:10:56.488321384+07:00""
Hint: Some lines were ellipsized, use -l to show in full.

At this point we also check the Docker version by submitting command line :

$ docker --version

The output :

[ramansah@dev01 ~]$ docker --version
Docker version 20.10.17, build 100c701

4. Verify Docker Engine

This is the last step in installing Docker, this step is to examine if our Doceker was installed and running correctly. For this purpose we will verify by running the hello-world image. We will pull an example image, called as hello-word, by submitting command line :

$ sudo docker run hello-world

The output :

[ramansah@dev01 ~]$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete 
Digest: sha256:53f1bbee2f52c39e41682ee1d388285290c5c8a76cc92b42687eecf38e0af3f0
Status: Downloaded newer image for hello-world:latest

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

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:

For more examples and ideas, visit:


On this short tutorial, we have learnt how to install Docker Community Edition version 20.10.17 on CentOS 7 operating system properly. I hope this article will be helpful.

(Visited 37 times, 1 visits today)

Leave a Reply

Your email address will not be published. Required fields are marked *