Difference between revisions of "Docker & Kubernetes"

From TheBestLinux.com
Jump to navigation Jump to search
Line 7: Line 7:
 
</pre>
 
</pre>
  
Reboot and double check that the Linux kernel overlay module is loaded with this command:
+
Reboot and double check that the Linux kernel <p style="color:red">overlay</p> module is loaded with this command:
 
<pre style="color:blue">
 
<pre style="color:blue">
 
[jamie@cos8vm51.dawgland.com:~]$ lsmod | grep overlay
 
[jamie@cos8vm51.dawgland.com:~]$ lsmod | grep overlay

Revision as of 21:41, 1 May 2021

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/superuser or with sudo, as seen here to enable the kernel module at each reboot:

[jamie@cos8vm51.dawgland.com:~]$ sudo 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 The actual number doesn't matter, as long as it shows the word "overlay", indicating the "Overlay" Linux kernel module is loaded into the kernel. 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 newer 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:

  • device-mapper-persistent-data
  • dnf-utils
  • 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.


First, become the root user:

[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:~]#


Add Docker-CE Software Repository to System

Use this command to add the Docker-CE software repository to your /etc/yum.repos.d directory. The CE in "Docker-CE" stands for "Community Edition", in case you're wondering! Having the Docker-CE yum repository allows you to easily add and remove Docker related software. Here's the command to install the "repo", as it's abbreviated:

[root@cos8minvm.dawgland.com:~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
[root@cos8minvm.dawgland.com:~]#



Kubernetes

Kubernetes info coming soon...