Install Docker Package

Ticker

6/recent/ticker-posts

Install Docker Package

 Question:  Last week the Nautilus DevOps team met with the application development team and decided to containerize several of their applications. The DevOps team wants to do some testing per the following:

Install docker-ce and docker-compose packages on App Server 1.

Start docker service.


Please Note :-  Perform the below commands based on your question  server,  user name & other details might differ . So please read task carefully before executing. All the Best 👍


Solution:  

1. Login on the App server given in task & switch to root user

thor@jump_host ~$ ssh tony@stapp01

The authenticity of host 'stapp01 (172.16.238.10)' can't be established.

ECDSA key fingerprint is SHA256:50YI9Vwvjd0iZMhre+NvEzAB6ceeBo31J3HCoXzkza0.

ECDSA key fingerprint is MD5:e9:1a:60:b6:4a:0e:39:f4:c9:79:93:d5:da:e1:31:6f.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'stapp01,172.16.238.10' (ECDSA) to the list of known hosts.

tony@stapp01's password:

[tony@stapp01 ~]$ sudo su -

We trust you have received the usual lecture from the local System

Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.

    #2) Think before you type.

    #3) With great power comes great responsibility.

[sudo] password for tony:

[root@stapp01 ~]#

 
2. Docker compose download form git from the given link below

[root@stapp01 ~]# curl -L "https://github.com/docker/compose/releases/download/1.28.6/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   1811      0 --:--:-- --:--:-- --:--:--  1813

100 11.6M  100 11.6M    0     0  11.4M      0  0:00:01  0:00:01 --:--:-- 28.4M

[root@stapp01 ~]#


3. Make sure to set  executable permission ( Refer Video below for more clarity )

[root@stapp01 ~]# ll /usr/local/bin/docker-compose

-rw-r--r-- 1 root root 12212176 Jun 29 12:50 /usr/local/bin/docker-compose

[root@stapp01 ~]#

[root@stapp01 ~]# chmod +x /usr/local/bin/docker-compose

[root@stapp01 ~]#

[root@stapp01 ~]# ll /usr/local/bin/docker-compose

-rwxr-xr-x 1 root root 12212176 Jun 29 12:50 /usr/local/bin/docker-compose

[root@stapp01 ~]#

 
4. Validate by running version

[root@stapp01 ~]# docker-compose --version

docker-compose version 1.28.6, build 5db8d86f

[root@stapp01 ~]#


5. To install docker-ce  need to configure repo from below link

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

Loaded plugins: fastestmirror, ovl

adding repo from: https://download.docker.com/linux/centos/docker-ce.repo

grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo

repo saved to /etc/yum.repos.d/docker-ce.repo

[root@stapp01 ~]#


6. Install docker 

[root@stapp01 ~]# yum install docker-ce docker-ce-cli containerd.io

Loaded plugins: fastestmirror, ovl

Loading mirror speeds from cached hostfile

 * base: mirrors.usinternet.com

 * extras: mirrors.liquidweb.com

 * updates: ftp.ussg.iu.edu

base                                                                           | 3.6 kB  00:00:00    

docker-ce-stable                                                               | 3.5 kB  00:00:00    

extras                                                                         | 2.9 kB  00:00:00    

updates                                                                        | 2.9 kB  00:00:00    

(1/6): base/7/x86_64/group_gz                                                  | 153 kB  00:00:00    

(2/6): docker-ce-stable/7/x86_64/updateinfo                                    |   55 B  00:00:00    

(3/6): docker-ce-stable/7/x86_64/primary_db                                    |  62 kB  00:00:00    

(4/6): updates/7/x86_64/primary_db                                             | 8.8 MB  00:00:00    

(6/6): base/7/x86_64/primary_db                                                | 6.1 MB  00:00:00    

Resolving Dependencies

--> Running transaction check

---> Package containerd.io.x86_64 0:1.4.6-3.1.el7 will be installed

--> Processing Dependency: container-selinux >= 2:2.74 for package: containerd.io-1.4.6-3.1.el7.x86_64

--> Processing Dependency: libseccomp for package: containerd.io-1.4.6-3.1.el7.x86_64

---> Package docker-ce.x86_64 3:20.10.7-3.el7 will be installed

--> Processing Dependency: docker-ce-rootless-extras for package: 3:docker-ce-20.10.7-3.el7.x86_64

--> Processing Dependency: libcgroup for package: 3:docker-ce-20.10.7-3.el7.x86_64

---> Package docker-ce-cli.x86_64 1:20.10.7-3.el7 will be installed

--> Processing Dependency: docker-scan-plugin(x86-64) for package: 1:docker-ce-cli-20.10.7-3.el7.x86_64

 (20/24): python-IPy-0.75-6.el7.noarch.rpm                                      |  32 kB  00:00:00    

(21/24): slirp4netns-0.4.3-4.el7_8.x86_64.rpm                                  |  81 kB  00:00:00     

(22/24): setools-libs-3.3.8-4.el7.x86_64.rpm                                   | 620 kB  00:00:00    

(23/24): selinux-policy-3.13.1-268.el7_9.2.noarch.rpm                          | 498 kB  00:00:00    

(24/24): selinux-policy-targeted-3.13.1-268.el7_9.2.noarch.rpm                 | 7.0 MB  00:00:00    

------------------------------------------------------------------------------------------------------

Total                                                                  30 MB/s | 118 MB  00:00:03    

Retrieving key from https://download.docker.com/linux/centos/gpg

Importing GPG key 0x621E9F35:

 Userid     : "Docker Release (CE rpm) <docker@docker.com>"

 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

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Updating   : libselinux-2.5-15.el7.x86_64                                                      1/26

  Installing : libseccomp-2.3.1-4.el7.x86_64                                                     2/26

  Installing : libselinux-utils-2.5-15.el7.x86_64                                                3/26

  Installing : docker-scan-plugin-0.8.0-3.el7.x86_64                                             4/26

  Installing : 1:docker-ce-cli-20.10.7-3.el7.x86_64                                              5/26

  Installing : libcgroup-0.41-21.el7.x86_64                                                      6/26

 Installed:

  containerd.io.x86_64 0:1.4.6-3.1.el7                docker-ce.x86_64 3:20.10.7-3.el7              

  docker-ce-cli.x86_64 1:20.10.7-3.el7              

 Dependency Installed:

  audit-libs-python.x86_64 0:2.8.5-4.el7                                                             

  checkpolicy.x86_64 0:2.5-8.el7                                                                      

  container-selinux.noarch 2:2.119.2-1.911c772.el7_8                                                 

  docker-ce-rootless-extras.x86_64 0:20.10.7-3.el7                                                   

  docker-scan-plugin.x86_64 0:0.8.0-3.el7                                                            

  fuse-overlayfs.x86_64 0:0.7.2-6.el7_8                                                              

  fuse3-libs.x86_64 0:3.6.1-4.el7                                                                     

  libcgroup.x86_64 0:0.41-21.el7                                                                     

  libseccomp.x86_64 0:2.3.1-4.el7                                                                    

  libselinux-python.x86_64 0:2.5-15.el7                                                              

  libselinux-utils.x86_64 0:2.5-15.el7                                                               

  libsemanage-python.x86_64 0:2.5-14.el7                                                              

  policycoreutils.x86_64 0:2.5-34.el7                                                                

  policycoreutils-python.x86_64 0:2.5-34.el7                                                         

  python-IPy.noarch 0:0.75-6.el7                                                                     

  selinux-policy.noarch 0:3.13.1-268.el7_9.2                                                         

  selinux-policy-targeted.noarch 0:3.13.1-268.el7_9.2                                                

  setools-libs.x86_64 0:3.3.8-4.el7                                                                  

  slirp4netns.x86_64 0:0.4.3-4.el7_8                                                                  

 Dependency Updated:

  audit-libs.x86_64 0:2.8.5-4.el7                    libselinux.x86_64 0:2.5-15.el7                  

 Complete!

[root@stapp01 ~]# 


7. Verify  docker installed successfully 

[root@stapp01 ~]# rpm -qa |grep docker

docker-scan-plugin-0.8.0-3.el7.x86_64

docker-ce-rootless-extras-20.10.7-3.el7.x86_64

docker-ce-cli-20.10.7-3.el7.x86_64

docker-ce-20.10.7-3.el7.x86_64

[root@stapp01 ~]#


8. Enable & start the docker service

root@stapp01 ~]# systemctl enable docker

Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

[root@stapp01 ~]#

[root@stapp01 ~]# systemctl start  docker

[root@stapp01 ~]#

[root@stapp01 ~]# 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 Tue 2021-06-29 12:55:55 UTC; 7s ago

     Docs: https://docs.docker.com

 Main PID: 1725 (dockerd)

    Tasks: 25

   Memory: 50.7M

   CGroup: /docker/c2f0a85697649e9098830a819bed7e35c15a34a296224f94dd1d04dfc63c652f/system.slice/docker.service

           └─1725 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

 Jun 29 12:55:55 stapp01.stratos.xfusioncorp.com dockerd[1725]: time="2021-06-29T12:55:55.175549626..."

Jun 29 12:55:55 stapp01.stratos.xfusioncorp.com dockerd[1725]: time="2021-06-29T12:55:55.265860107...7

Jun 29 12:55:55 stapp01.stratos.xfusioncorp.com dockerd[1725]: time="2021-06-29T12:55:55.266050973..."

Jun 29 12:55:55 stapp01.stratos.xfusioncorp.com systemd[1]: Got notification message for unit doc...ce

Jun 29 12:55:55 stapp01.stratos.xfusioncorp.com systemd[1]: docker.service: Got notification mess...1)

Jun 29 12:55:55 stapp01.stratos.xfusioncorp.com systemd[1]: docker.service: got READY=1

Jun 29 12:55:55 stapp01.stratos.xfusioncorp.com systemd[1]: docker.service changed start -> running

Jun 29 12:55:55 stapp01.stratos.xfusioncorp.com systemd[1]: Job docker.service/start finished, re...ne

Jun 29 12:55:55 stapp01.stratos.xfusioncorp.com systemd[1]: Started Docker Application Container ...e.

Jun 29 12:55:55 stapp01.stratos.xfusioncorp.com dockerd[1725]: time="2021-06-29T12:55:55.486621983..."

Hint: Some lines were ellipsized, use -l to show in full.

[root@stapp01 ~]#


9. Validate the task 

[root@stapp01 ~]# docker --version

Docker version 20.10.7, build f0df350

[root@stapp01 ~]#

[root@stapp01 ~]# docker ps

CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

[root@stapp01 ~]#

[root@stapp01 ~]# docker-compose --version

docker-compose version 1.28.6, build 5db8d86f

[root@stapp01 ~]#


10.  Click on Finish & Confirm to complete the task successful

Happy Learning!!!!


Apart from this if you need more clarity,  I have made a  tutorial video on this , 

please go through and share your comments. Like and share the knowledge



Post a Comment

0 Comments

Latest Posts

Kodekloud Server's Login Credentials