Sunday, January 23, 2022

How To Install Docker On CentOS 8/Rocky Linux 8

URL: https://phoenixnap.com/kb/how-to-install-docker-on-centos-8

1. Use DNF to add and enable the official Docker CE repository. Type the following command in your terminal window
------------------------------------------------------------------------------------------------------------------
[root@thermalite ~]# dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo                                                                                                    tion
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo

2. Check all relevant repolist details.
---------------------------------------
[root@thermalite ~]# dnf repolist -v
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, kpatch, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
DNF version: 4.4.2
cachedir: /var/cache/dnf
Repository packages-microsoft-com-prod is listed more than once in the configuration
Repository packages-microsoft-com-prod is listed more than once in the configuration
Docker CE Stable - x86_64                                                                                                                                       131 kB/s |  14 kB     00:00
Last metadata expiration check: 0:00:01 ago on Sun 13 Jun 2021 08:31:12 AM EDT.
Repo-id            : appstream
Repo-name          : CentOS Linux 8 - AppStream
Repo-revision      : 8.4.2105
Repo-distro-tags      : [cpe:/o:centos:centos:8]:  , 8, C, O, S, e, n, t
Repo-updated       : Tue 08 Jun 2021 12:04:59 PM EDT
Repo-pkgs          : 6,133
Repo-available-pkgs: 5,254
Repo-size          : 8.8 G
Repo-mirrors       : http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock
Repo-baseurl       : http://mirrors.xmission.com/centos/8.4.2105/AppStream/x86_64/os/ (9 more)
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:11 AM EDT)
Repo-filename      : /etc/yum.repos.d/CentOS-Linux-AppStream.repo

Repo-id            : baseos
Repo-name          : CentOS Linux 8 - BaseOS
Repo-revision      : 8.4.2105
Repo-distro-tags      : [cpe:/o:centos:centos:8]:  , 8, C, O, S, e, n, t
Repo-updated       : Tue 08 Jun 2021 12:04:44 PM EDT
Repo-pkgs          : 1,745
Repo-available-pkgs: 1,743
Repo-size          : 1.2 G
Repo-mirrors       : http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=BaseOS&infra=stock
Repo-baseurl       : http://mirror.arizona.edu/centos/8.4.2105/BaseOS/x86_64/os/ (9 more)
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:11 AM EDT)
Repo-filename      : /etc/yum.repos.d/CentOS-Linux-BaseOS.repo

Repo-id            : docker-ce-stable
Repo-name          : Docker CE Stable - x86_64
Repo-revision      : 1622662057
Repo-updated       : Wed 02 Jun 2021 03:27:37 PM EDT
Repo-pkgs          : 38
Repo-available-pkgs: 38
Repo-size          : 937 M
Repo-baseurl       : https://download.docker.com/linux/centos/8/x86_64/stable
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 08:31:12 AM EDT)
Repo-filename      : /etc/yum.repos.d/docker-ce.repo

Repo-id            : epel
Repo-name          : Extra Packages for Enterprise Linux 8 - x86_64
Repo-revision      : 1623461479
Repo-updated       : Fri 11 Jun 2021 09:31:50 PM EDT
Repo-pkgs          : 7,440
Repo-available-pkgs: 7,437
Repo-size          : 11 G
Repo-metalink      : https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=x86_64&infra=stock&content=centos
  Updated          : Sun 13 Jun 2021 04:29:12 AM EDT
Repo-baseurl       : https://download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/ (48 more)
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:12 AM EDT)
Repo-filename      : /etc/yum.repos.d/epel.repo

Repo-id            : epel-modular
Repo-name          : Extra Packages for Enterprise Linux Modular 8 - x86_64
Repo-revision      : 1623287700
Repo-updated       : Wed 09 Jun 2021 09:15:14 PM EDT
Repo-pkgs          : 182
Repo-available-pkgs: 0
Repo-size          : 536 M
Repo-metalink      : https://mirrors.fedoraproject.org/metalink?repo=epel-modular-8&arch=x86_64&infra=stock&content=centos
  Updated          : Sun 13 Jun 2021 04:29:12 AM EDT
Repo-baseurl       : http://epel.mirror.constant.com/8/Modular/x86_64/ (50 more)
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:12 AM EDT)
Repo-filename      : /etc/yum.repos.d/epel-modular.repo

Repo-id            : extras
Repo-name          : CentOS Linux 8 - Extras
Repo-revision      : 1618497802
Repo-updated       : Thu 15 Apr 2021 10:42:53 AM EDT
Repo-pkgs          : 34
Repo-available-pkgs: 34
Repo-size          : 385 k
Repo-mirrors       : http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=extras&infra=stock
Repo-baseurl       : http://sjc.edge.kernel.org/centos/8.4.2105/extras/x86_64/os/ (9 more)
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:11 AM EDT)
Repo-filename      : /etc/yum.repos.d/CentOS-Linux-Extras.repo

Repo-id            : google-chrome
Repo-name          : google-chrome
Repo-revision      : 1623354504
Repo-updated       : Thu 10 Jun 2021 03:48:24 PM EDT
Repo-pkgs          : 3
Repo-available-pkgs: 3
Repo-size          : 237 M
Repo-baseurl       : http://dl.google.com/linux/chrome/rpm/stable/x86_64
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:12 AM EDT)
Repo-filename      : /etc/yum.repos.d/google-chrome.repo

Repo-id            : jenkins
Repo-name          : Jenkins-stable
Repo-revision      : 1622703353
Repo-updated       : Thu 03 Jun 2021 02:55:54 AM EDT
Repo-pkgs          : 121
Repo-available-pkgs: 121
Repo-size          : 7.3 G
Repo-baseurl       : http://pkg.jenkins.io/redhat-stable
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:12 AM EDT)
Repo-filename      : /etc/yum.repos.d/jenkins.repo

Repo-id            : packages-microsoft-com-mssql-server-2019
Repo-name          : packages-microsoft-com-mssql-server-2019
Repo-revision      : 1623361364
Repo-updated       : Thu 10 Jun 2021 05:42:44 PM EDT
Repo-pkgs          : 115
Repo-available-pkgs: 115
Repo-size          : 16 G
Repo-baseurl       : https://packages.microsoft.com/rhel/8/mssql-server-2019/
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:13 AM EDT)
Repo-filename      : /etc/yum.repos.d/mssql-server-2019.repo

Repo-id            : packages-microsoft-com-prod
Repo-name          : packages-microsoft-com-prod
Repo-revision      : 1623344677
Repo-updated       : Thu 10 Jun 2021 01:04:37 PM EDT
Repo-pkgs          : 304
Repo-available-pkgs: 304
Repo-size          : 8.8 G
Repo-baseurl       : https://packages.microsoft.com/centos/8/prod
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:12 AM EDT)
Repo-filename      : /etc/yum.repos.d/microsoft-prod.repo
Total packages: 16,115

3. To list all the available docker-ce packages, type:
------------------------------------------------------
[root@thermalite ~]# dnf list docker-ce --showduplicates | sort -r
Repository packages-microsoft-com-prod is listed more than once in the configuration
Repository packages-microsoft-com-prod is listed more than once in the configuration
Last metadata expiration check: 0:00:11 ago on Sun 13 Jun 2021 08:31:12 AM EDT.
docker-ce.x86_64                3:20.10.7-3.el8                 docker-ce-stable
docker-ce.x86_64                3:20.10.6-3.el8                 docker-ce-stable
docker-ce.x86_64                3:20.10.5-3.el8                 docker-ce-stable
docker-ce.x86_64                3:20.10.4-3.el8                 docker-ce-stable
docker-ce.x86_64                3:20.10.3-3.el8                 docker-ce-stable
docker-ce.x86_64                3:20.10.2-3.el8                 docker-ce-stable
docker-ce.x86_64                3:20.10.1-3.el8                 docker-ce-stable
docker-ce.x86_64                3:20.10.0-3.el8                 docker-ce-stable
docker-ce.x86_64                3:19.03.15-3.el8                docker-ce-stable
docker-ce.x86_64                3:19.03.14-3.el8                docker-ce-stable
docker-ce.x86_64                3:19.03.13-3.el8                docker-ce-stable
Available Packages

4. install docker
------------------------------------------------------
[root@thermalite ~]# dnf install docker-ce --nobest
Repository packages-microsoft-com-prod is listed more than once in the configuration
Repository packages-microsoft-com-prod is listed more than once in the configuration
Last metadata expiration check: 0:00:46 ago on Sun 13 Jun 2021 08:31:12 AM EDT.
Dependencies resolved.
================================================================================================================================================================================================
 Package                                          Architecture                  Version                                                           Repository                               Size
================================================================================================================================================================================================
Installing:
 docker-ce                                        x86_64                        3:20.10.7-3.el8                                                   docker-ce-stable                         27 M
Installing dependencies:
 container-selinux                                noarch                        2:2.158.0-1.module_el8.4.0+781+acf4c33b                           appstream                                51 k
 containerd.io                                    x86_64                        1.4.6-3.1.el8                                                     docker-ce-stable                         34 M
 docker-ce-cli                                    x86_64                        1:20.10.7-3.el8                                                   docker-ce-stable                         33 M
 docker-ce-rootless-extras                        x86_64                        20.10.7-3.el8                                                     docker-ce-stable                        9.2 M
 docker-scan-plugin                               x86_64                        0.8.0-3.el8                                                       docker-ce-stable                        4.2 M
 fuse-overlayfs                                   x86_64                        1.4.0-2.module_el8.4.0+673+eabfc99d                               appstream                                72 k
 fuse3                                            x86_64                        3.2.1-12.el8                                                      baseos                                   50 k
 fuse3-libs                                       x86_64                        3.2.1-12.el8                                                      baseos                                   94 k
 libcgroup                                        x86_64                        0.41-19.el8                                                       baseos                                   70 k
 libslirp                                         x86_64                        4.3.1-1.module_el8.4.0+575+63b40ad7                               appstream                                69 k
 slirp4netns                                      x86_64                        1.1.8-1.module_el8.4.0+641+6116a774                               appstream                                51 k
Enabling module streams:
 container-tools                                                                rhel8

Transaction Summary
================================================================================================================================================================================================
Install  12 Packages

Total download size: 107 M
Installed size: 439 M
Is this ok [y/N]: y
Downloading Packages:
(1/12): fuse-overlayfs-1.4.0-2.module_el8.4.0+673+eabfc99d.x86_64.rpm                                                                                           735 kB/s |  72 kB     00:00
(2/12): libslirp-4.3.1-1.module_el8.4.0+575+63b40ad7.x86_64.rpm                                                                                                 668 kB/s |  69 kB     00:00
(3/12): container-selinux-2.158.0-1.module_el8.4.0+781+acf4c33b.noarch.rpm                                                                                      481 kB/s |  51 kB     00:00
(4/12): slirp4netns-1.1.8-1.module_el8.4.0+641+6116a774.x86_64.rpm                                                                                              2.4 MB/s |  51 kB     00:00
(5/12): fuse3-3.2.1-12.el8.x86_64.rpm                                                                                                                           205 kB/s |  50 kB     00:00
(6/12): libcgroup-0.41-19.el8.x86_64.rpm                                                                                                                        295 kB/s |  70 kB     00:00
(7/12): fuse3-libs-3.2.1-12.el8.x86_64.rpm                                                                                                                      367 kB/s |  94 kB     00:00
(8/12): docker-ce-20.10.7-3.el8.x86_64.rpm                                                                                                                       27 MB/s |  27 MB     00:00
(9/12): docker-ce-cli-20.10.7-3.el8.x86_64.rpm                                                                                                                   31 MB/s |  33 MB     00:01
(10/12): containerd.io-1.4.6-3.1.el8.x86_64.rpm                                                                                                                  28 MB/s |  34 MB     00:01
(11/12): docker-scan-plugin-0.8.0-3.el8.x86_64.rpm                                                                                                               26 MB/s | 4.2 MB     00:00
(12/12): docker-ce-rootless-extras-20.10.7-3.el8.x86_64.rpm                                                                                                      26 MB/s | 9.2 MB     00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                            51 MB/s | 107 MB     00:02
warning: /var/cache/dnf/docker-ce-stable-fa9dc42ab4cec2f4/packages/containerd.io-1.4.6-3.1.el8.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Docker CE Stable - x86_64                                                                                                                                        40 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/centos/gpg
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                        1/1
  Installing       : docker-scan-plugin-0.8.0-3.el8.x86_64                                                                                                                                 1/12
  Running scriptlet: docker-scan-plugin-0.8.0-3.el8.x86_64                                                                                                                                 1/12
  Installing       : docker-ce-cli-1:20.10.7-3.el8.x86_64                                                                                                                                  2/12
  Running scriptlet: docker-ce-cli-1:20.10.7-3.el8.x86_64                                                                                                                                  2/12
  Running scriptlet: container-selinux-2:2.158.0-1.module_el8.4.0+781+acf4c33b.noarch                                                                                                      3/12
  Installing       : container-selinux-2:2.158.0-1.module_el8.4.0+781+acf4c33b.noarch                                                                                                      3/12
  Running scriptlet: container-selinux-2:2.158.0-1.module_el8.4.0+781+acf4c33b.noarch                                                                                                      3/12
  Installing       : containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                    4/12
  Running scriptlet: containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                    4/12
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                                                                                                                                          5/12
  Installing       : libcgroup-0.41-19.el8.x86_64                                                                                                                                          5/12
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                                                                                                                                          5/12
  Installing       : fuse3-libs-3.2.1-12.el8.x86_64                                                                                                                                        6/12
  Running scriptlet: fuse3-libs-3.2.1-12.el8.x86_64                                                                                                                                        6/12
  Installing       : fuse3-3.2.1-12.el8.x86_64                                                                                                                                             7/12
  Installing       : fuse-overlayfs-1.4.0-2.module_el8.4.0+673+eabfc99d.x86_64                                                                                                             8/12
  Running scriptlet: fuse-overlayfs-1.4.0-2.module_el8.4.0+673+eabfc99d.x86_64                                                                                                             8/12
  Installing       : libslirp-4.3.1-1.module_el8.4.0+575+63b40ad7.x86_64                                                                                                                   9/12
  Installing       : slirp4netns-1.1.8-1.module_el8.4.0+641+6116a774.x86_64                                                                                                               10/12
  Installing       : docker-ce-rootless-extras-20.10.7-3.el8.x86_64                                                                                                                       11/12
  Running scriptlet: docker-ce-rootless-extras-20.10.7-3.el8.x86_64                                                                                                                       11/12
  Installing       : docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                     12/12
  Running scriptlet: docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                     12/12
  Running scriptlet: container-selinux-2:2.158.0-1.module_el8.4.0+781+acf4c33b.noarch                                                                                                     12/12
  Running scriptlet: docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                     12/12
  Verifying        : container-selinux-2:2.158.0-1.module_el8.4.0+781+acf4c33b.noarch                                                                                                      1/12
  Verifying        : fuse-overlayfs-1.4.0-2.module_el8.4.0+673+eabfc99d.x86_64                                                                                                             2/12
  Verifying        : libslirp-4.3.1-1.module_el8.4.0+575+63b40ad7.x86_64                                                                                                                   3/12
  Verifying        : slirp4netns-1.1.8-1.module_el8.4.0+641+6116a774.x86_64                                                                                                                4/12
  Verifying        : fuse3-3.2.1-12.el8.x86_64                                                                                                                                             5/12
  Verifying        : fuse3-libs-3.2.1-12.el8.x86_64                                                                                                                                        6/12
  Verifying        : libcgroup-0.41-19.el8.x86_64                                                                                                                                          7/12
  Verifying        : containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                    8/12
  Verifying        : docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                      9/12
  Verifying        : docker-ce-cli-1:20.10.7-3.el8.x86_64                                                                                                                                 10/12
  Verifying        : docker-ce-rootless-extras-20.10.7-3.el8.x86_64                                                                                                                       11/12
  Verifying        : docker-scan-plugin-0.8.0-3.el8.x86_64                                                                                                                                12/12

Installed:
  container-selinux-2:2.158.0-1.module_el8.4.0+781+acf4c33b.noarch       containerd.io-1.4.6-3.1.el8.x86_64                        docker-ce-3:20.10.7-3.el8.x86_64
  docker-ce-cli-1:20.10.7-3.el8.x86_64                                   docker-ce-rootless-extras-20.10.7-3.el8.x86_64            docker-scan-plugin-0.8.0-3.el8.x86_64
  fuse-overlayfs-1.4.0-2.module_el8.4.0+673+eabfc99d.x86_64              fuse3-3.2.1-12.el8.x86_64                                 fuse3-libs-3.2.1-12.el8.x86_64
  libcgroup-0.41-19.el8.x86_64                                           libslirp-4.3.1-1.module_el8.4.0+575+63b40ad7.x86_64       slirp4netns-1.1.8-1.module_el8.4.0+641+6116a774.x86_64

Complete!
[root@thermalite ~]#

5. install containerd.io Package Manually
------------------------------------------------------------------------
[root@thermalite ~]# dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.10-3.2.el7.x86_64.rpm
Repository packages-microsoft-com-prod is listed more than once in the configuration
Repository packages-microsoft-com-prod is listed more than once in the configuration
Last metadata expiration check: 0:08:07 ago on Sun 13 Jun 2021 08:33:07 AM EDT.
containerd.io-1.2.10-3.2.el7.x86_64.rpm                                                                                                                          74 MB/s |  23 MB     00:00
Dependencies resolved.
================================================================================================================================================================================================
 Package                                       Architecture                           Version                                            Repository                                        Size
================================================================================================================================================================================================
Downgrading:
 containerd.io                                 x86_64                                 1.2.10-3.2.el7                                     @commandline                                      23 M
 docker-ce                                     x86_64                                 3:19.03.15-3.el8                                   docker-ce-stable                                  24 M

Transaction Summary
================================================================================================================================================================================================
Downgrade  2 Packages

Total size: 47 M
Total download size: 24 M
Is this ok [y/N]: y
Downloading Packages:
docker-ce-19.03.15-3.el8.x86_64.rpm                                                                                                                              58 MB/s |  24 MB     00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                            58 MB/s |  24 MB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                        1/1
  Running scriptlet: containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                    1/1
  Downgrading      : containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                    1/4
  Running scriptlet: containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                    1/4
  Downgrading      : docker-ce-3:19.03.15-3.el8.x86_64                                                                                                                                      2/4
  Running scriptlet: docker-ce-3:19.03.15-3.el8.x86_64                                                                                                                                      2/4
  Running scriptlet: docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                       3/4
  Cleanup          : docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                       3/4
  Running scriptlet: docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                       3/4
  Running scriptlet: containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                     4/4
  Cleanup          : containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                     4/4
  Running scriptlet: containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                     4/4
  Verifying        : docker-ce-3:19.03.15-3.el8.x86_64                                                                                                                                      1/4
  Verifying        : docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                       2/4
  Verifying        : containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                    3/4
  Verifying        : containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                     4/4

Downgraded:
  containerd.io-1.2.10-3.2.el7.x86_64                                                             docker-ce-3:19.03.15-3.el8.x86_64

Complete!

[root@thermalite ~]#

6. Now we can proceed to install the latest version of docker-ce with a simple command
---------------------------------------------------------------------------------------
[root@thermalite ~]# dnf install docker-ce -y
Repository packages-microsoft-com-prod is listed more than once in the configuration
Repository packages-microsoft-com-prod is listed more than once in the configuration
Last metadata expiration check: 0:09:03 ago on Sun 13 Jun 2021 08:33:07 AM EDT.
Package docker-ce-3:19.03.15-3.el8.x86_64 is already installed.
Dependencies resolved.
================================================================================================================================================================================================
 Package                                       Architecture                           Version                                            Repository                                        Size
================================================================================================================================================================================================
Upgrading:
 containerd.io                                 x86_64                                 1.4.6-3.1.el8                                      docker-ce-stable                                  34 M
 docker-ce                                     x86_64                                 3:20.10.7-3.el8                                    docker-ce-stable                                  27 M

Transaction Summary
================================================================================================================================================================================================
Upgrade  2 Packages

Total download size: 60 M
Downloading Packages:
(1/2): docker-ce-20.10.7-3.el8.x86_64.rpm                                                                                                                        48 MB/s |  27 MB     00:00
(2/2): containerd.io-1.4.6-3.1.el8.x86_64.rpm                                                                                                                    40 MB/s |  34 MB     00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                            72 MB/s |  60 MB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                        1/1
  Running scriptlet: containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                     1/1
  Upgrading        : containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                     1/4
  Running scriptlet: containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                     1/4
  Upgrading        : docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                       2/4
  Running scriptlet: docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                       2/4
  Running scriptlet: docker-ce-3:19.03.15-3.el8.x86_64                                                                                                                                      3/4
  Cleanup          : docker-ce-3:19.03.15-3.el8.x86_64                                                                                                                                      3/4
  Running scriptlet: docker-ce-3:19.03.15-3.el8.x86_64                                                                                                                                      3/4
  Running scriptlet: containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                    4/4
  Cleanup          : containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                    4/4
  Running scriptlet: containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                    4/4
  Verifying        : containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                     1/4
  Verifying        : containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                    2/4
  Verifying        : docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                       3/4
  Verifying        : docker-ce-3:19.03.15-3.el8.x86_64                                                                                                                                      4/4

Upgraded:
  containerd.io-1.4.6-3.1.el8.x86_64                                                              docker-ce-3:20.10.7-3.el8.x86_64

Complete!

[root@thermalite ~]#

7.Start and Test Docker, Enable Docker
---------------------------------------
[root@thermalite ~]# systemctl enable --now docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.

8. Next, use this short command to confirm that Docker is active and running:
-----------------------------------------------------------------------------
[root@thermalite ~]# 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 Sun 2021-06-13 08:43:10 EDT; 9s ago
     Docs: https://docs.docker.com
 Main PID: 24248 (dockerd)
    Tasks: 12
   Memory: 47.8M
   CGroup: /system.slice/docker.service
           └─24248 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Jun 13 08:43:09 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:09.443251237-04:00" level=warning msg="Your kernel does not support cgroup blkio weight"
Jun 13 08:43:09 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:09.443276846-04:00" level=warning msg="Your kernel does not support cgroup blkio weight_device"
Jun 13 08:43:09 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:09.443418994-04:00" level=info msg="Loading containers: start."
Jun 13 08:43:10 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:10.408960141-04:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon>
Jun 13 08:43:10 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:10.523460635-04:00" level=info msg="Firewalld: interface docker0 already part of docker zone, returning"
Jun 13 08:43:10 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:10.694621276-04:00" level=info msg="Loading containers: done."
Jun 13 08:43:10 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:10.802528833-04:00" level=info msg="Docker daemon" commit=b0f5bc3 graphdriver(s)=overlay2 version=20.10.7
Jun 13 08:43:10 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:10.802629176-04:00" level=info msg="Daemon has completed initialization"
Jun 13 08:43:10 thermalite.localdomain systemd[1]: Started Docker Application Container Engine.
Jun 13 08:43:10 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:10.960984827-04:00" level=info msg="API listen on /var/run/docker.sock"
[root@thermalite ~]#

9. Login as ordinary user, and add your user to the docker group with the following command:
---------------------------------------------------------------
[malex@thermalite ~]$ sudo usermod -aG docker $USER
[sudo] password for malex:
[malex@thermalite ~]$  id $USER
uid=1002(malex) gid=1002(malex) groups=1002(malex),970(docker)
[malex@thermalite ~]$

10. check docker installation
-----------------------------
[malex@thermalite ~]$ rpm -qa | grep docker
docker-scan-plugin-0.8.0-3.el8.x86_64
docker-ce-cli-20.10.7-3.el8.x86_64
docker-ce-20.10.7-3.el8.x86_64
docker-ce-rootless-extras-20.10.7-3.el8.x86_64

11. check docker version
-----------------------------
[malex@thermalite ~]$ docker --version
Docker version 20.10.7, build f0df350

12. test docker pull
-----------------------------
[malex@thermalite ~]$ docker pull alpine
Using default tag: latest
latest: Pulling from library/alpine
540db60ca938: Pull complete
Digest: sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f
Status: Downloaded newer image for alpine:latest
docker.io/library/alpine:latest

13. list docker image
-----------------------------
[malex@thermalite ~]$ sudo docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
alpine       latest    6dbb9cc54074   8 weeks ago   5.61MB

14. test run docker image
-----------------------------
[malex@thermalite ~]$ sudo docker run -it --rm alpine /bin/sh
/ # apk update
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
v3.13.5-194-g1274644b64 [https://dl-cdn.alpinelinux.org/alpine/v3.13/main]
v3.13.5-187-g1477654ee3 [https://dl-cdn.alpinelinux.org/alpine/v3.13/community]
OK: 13890 distinct packages available
/ # exit

Install Docker Compose

15. download docker-compose
-----------------------------
[root@thermalite ~]# curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   633  100   633    0     0   4137      0 --:--:-- --:--:-- --:--:--  4110
100 16.2M  100 16.2M    0     0  21.8M      0 --:--:-- --:--:-- --:--:-- 21.8M

16. set docker-compose to runnable
---------------------------------------------------
[root@thermalite ~]# chmod +x /usr/local/bin/docker-compose

17. check version
---------------------------------------------------
[root@thermalite ~]# docker-compose --version
docker-compose version 1.25.0, build 0a186604

18. execute several test runs
---------------------------------------------------
[malex@thermalite ~]$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:9f6ad537c5132bcce57f7a0a20e317228d382c3cd61edae14650eec68b2b345c
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.
    (amd64)
 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:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/


[malex@thermalite ~]$  docker run -it ubuntu bash
root@67b24aca2432:/# exit
exit

[malex@thermalite ~]$ 

No comments:

Post a Comment