Docker & Kubernetes

From TheBestLinux.com
Revision as of 03:18, 7 April 2021 by Jamie (talk | contribs)
Jump to navigation Jump to search

Docker

(

NOTICE: The following documentation refers to installation of Docker on a Red Hat Enterprise or CentOS Linux Server

)

Overlay Linux Kernel Driver

To begin with, Docker runs best with the "overlay2" Linux kernel driver enabled/loaded. Run this command as the root/superer or with sudo, as seen here to enable the kernel module at each reboot:

[jamie@cos8vm51.dawgland.com:~]$ echo "overlay" > /etc/modules-load.d/overlay.conf;

Reboot and double check that the Linux kernel overlay module is loaded with this command:

[jamie@cos8vm51.dawgland.com:~]$ lsmod | grep overlay
overlay               135168  0
[jamie@cos8vm51.dawgland.com:~]$ 

If you get the "overlay 135168 0" response after typing the "lsmod | grep overlay" command, you are good to go. If not, you need a newer Linux kernel that supports the overlay2 driver, which is beyond the scope of this article, and you basically need to pick a different Linux distribution.



Required Packages

Docker requires some basic utilities and tools provided by specific Linux packages. For Red Hat Enterprise Linux and CentOS Linux, these packages at minimum are required:

  • dnf-utils
  • device-mapper-persistent-data
  • fuse-overlayfs
  • lvm2
  • wget


To install these packages, or at least double check to make sure they are installed, and if not, then install them, open up a terminal if you are not already at the command prompt of the machine you want to install Docker on. Then, become the root/superuser. I use the "sudo" utility to do this, but you may have other methods depending on your system and preferences.

Here is an example of me doing so on a brand new VM(Virtual Machine) with a minimal installation of CentOS 8, fully updated using the "DNF" utility, which I will also demonstrate the command used to check for updates and refresh the package cache:

[jamie@cos8minvm.dawgland.com:~]$ sudo su -
Last login: Tue Apr  6 19:41:31 PDT 2021 on pts/0
[root@cos8minvm.dawgland.com:~]#


And now that I am the "root", aka the "SuperUser", I will check for updates and refresh the package cache in one command:

[root@cos8minvm.dawgland.com:~]# dnf check-update --refresh
CentOS Linux 8 - AppStream                      7.5 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                          12 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Extras                          51  B/s | 1.5 kB     00:30    
Extra Packages for Enterprise Linux Modular 8 -  27 kB/s |  15 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64   33 kB/s |  14 kB     00:00    
[root@cos8minvm.dawgland.com:~]#


And the actual command to install the required packages, using the DNF utility. If you are running a pre-8.x version of Red Hat Enterprise or CentOS, substitute "yum" in place of "dnf":

[root@cos8minvm.dawgland.com:~]# dnf -y install device-mapper-persistent-data dnf-utils fuse-overlayfs lvm2 wget
Last metadata expiration check: 0:05:46 ago on Tue 06 Apr 2021 08:06:14 PM PDT.
Dependencies resolved.
================================================================================
 Package                       Arch   Version                   Repo       Size
================================================================================
Installing:
 device-mapper-persistent-data x86_64 0.8.5-4.el8               baseos    468 k
 fuse-overlayfs                x86_64 1.3.0-2.module_el8.3.0+699+d61d9c41
                                                                appstream  72 k
 lvm2                          x86_64 8:2.03.09-5.el8           baseos    1.6 M
 wget                          x86_64 1.19.5-10.el8             appstream 734 k
 yum-utils                     noarch 4.0.17-5.el8              baseos     68 k
Installing dependencies:
 device-mapper-event           x86_64 8:1.02.171-5.el8          baseos    268 k
 device-mapper-event-libs      x86_64 8:1.02.171-5.el8          baseos    267 k
 fuse3                         x86_64 3.2.1-12.el8              baseos     50 k
 fuse3-libs                    x86_64 3.2.1-12.el8              baseos     94 k
 libaio                        x86_64 0.3.112-1.el8             baseos     33 k
 lvm2-libs                     x86_64 8:2.03.09-5.el8           baseos    1.1 M
Enabling module streams:
 container-tools                      rhel8                                    

Transaction Summary
================================================================================
Install  11 Packages

Total download size: 4.7 M
Installed size: 11 M
Downloading Packages:
(1/11): device-mapper-event-1.02.171-5.el8.x86_ 644 kB/s | 268 kB     00:00    
(2/11): device-mapper-event-libs-1.02.171-5.el8 2.3 MB/s | 267 kB     00:00    
(3/11): fuse-overlayfs-1.3.0-2.module_el8.3.0+6 130 kB/s |  72 kB     00:00    
(4/11): device-mapper-persistent-data-0.8.5-4.e 3.9 MB/s | 468 kB     00:00    
(5/11): fuse3-libs-3.2.1-12.el8.x86_64.rpm      1.6 MB/s |  94 kB     00:00    
(6/11): libaio-0.3.112-1.el8.x86_64.rpm         564 kB/s |  33 kB     00:00    
(7/11): fuse3-3.2.1-12.el8.x86_64.rpm           231 kB/s |  50 kB     00:00    
(8/11): lvm2-2.03.09-5.el8.x86_64.rpm           6.2 MB/s | 1.6 MB     00:00    
(9/11): yum-utils-4.0.17-5.el8.noarch.rpm       1.2 MB/s |  68 kB     00:00    
(10/11): lvm2-libs-2.03.09-5.el8.x86_64.rpm     2.7 MB/s | 1.1 MB     00:00    
(11/11): wget-1.19.5-10.el8.x86_64.rpm          485 kB/s | 734 kB     00:01    
--------------------------------------------------------------------------------
Total                                           1.0 MB/s | 4.7 MB     00:04     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : libaio-0.3.112-1.el8.x86_64                           1/11 
  Installing       : device-mapper-event-libs-8:1.02.171-5.el8.x86_64      2/11 
  Installing       : device-mapper-event-8:1.02.171-5.el8.x86_64           3/11 
  Running scriptlet: device-mapper-event-8:1.02.171-5.el8.x86_64           3/11 
  Installing       : lvm2-libs-8:2.03.09-5.el8.x86_64                      4/11 
  Installing       : device-mapper-persistent-data-0.8.5-4.el8.x86_64      5/11 
  Installing       : fuse3-libs-3.2.1-12.el8.x86_64                        6/11 
  Running scriptlet: fuse3-libs-3.2.1-12.el8.x86_64                        6/11 
  Installing       : fuse3-3.2.1-12.el8.x86_64                             7/11 
  Installing       : fuse-overlayfs-1.3.0-2.module_el8.3.0+699+d61d9c41    8/11 
  Running scriptlet: fuse-overlayfs-1.3.0-2.module_el8.3.0+699+d61d9c41    8/11 
  Installing       : lvm2-8:2.03.09-5.el8.x86_64                           9/11 
  Running scriptlet: lvm2-8:2.03.09-5.el8.x86_64                           9/11 
  Installing       : yum-utils-4.0.17-5.el8.noarch                        10/11 
  Installing       : wget-1.19.5-10.el8.x86_64                            11/11 
  Running scriptlet: wget-1.19.5-10.el8.x86_64                            11/11 
  Verifying        : fuse-overlayfs-1.3.0-2.module_el8.3.0+699+d61d9c41    1/11 
  Verifying        : wget-1.19.5-10.el8.x86_64                             2/11 
  Verifying        : device-mapper-event-8:1.02.171-5.el8.x86_64           3/11 
  Verifying        : device-mapper-event-libs-8:1.02.171-5.el8.x86_64      4/11 
  Verifying        : device-mapper-persistent-data-0.8.5-4.el8.x86_64      5/11 
  Verifying        : fuse3-3.2.1-12.el8.x86_64                             6/11 
  Verifying        : fuse3-libs-3.2.1-12.el8.x86_64                        7/11 
  Verifying        : libaio-0.3.112-1.el8.x86_64                           8/11 
  Verifying        : lvm2-8:2.03.09-5.el8.x86_64                           9/11 
  Verifying        : lvm2-libs-8:2.03.09-5.el8.x86_64                     10/11 
  Verifying        : yum-utils-4.0.17-5.el8.noarch                        11/11 

Installed:
  device-mapper-event-8:1.02.171-5.el8.x86_64                                   
  device-mapper-event-libs-8:1.02.171-5.el8.x86_64                              
  device-mapper-persistent-data-0.8.5-4.el8.x86_64                              
  fuse-overlayfs-1.3.0-2.module_el8.3.0+699+d61d9c41.x86_64                     
  fuse3-3.2.1-12.el8.x86_64                                                     
  fuse3-libs-3.2.1-12.el8.x86_64                                                
  libaio-0.3.112-1.el8.x86_64                                                   
  lvm2-8:2.03.09-5.el8.x86_64                                                   
  lvm2-libs-8:2.03.09-5.el8.x86_64                                              
  wget-1.19.5-10.el8.x86_64                                                     
  yum-utils-4.0.17-5.el8.noarch                                                 

Complete!
[root@cos8minvm.dawgland.com:~]#


Kubernetes

Kubernetes info coming soon...