How to Install Docker on Oracle Linux

To Install Docker on Oracle Linux

Introduction :

The Docker is a operating system virtualization technology allows applications to be packaged as containerized files. This is fundamental to cloud computing, as containerized applications can run on any infrastructure, regardless of the provider.

Installation steps:

Step 1 : check the version of the OS

[root@linuxhelp ~]# cat /etc/os-release 
NAME="Oracle Linux Server"
VERSION="8.4"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.4"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:8:4:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"

Step 2 : Install yum-utils packages by using the below command

 [root@linuxhelp ~]# yum install yum-utils
Last metadata expiration check: 1 day, 5:04:54 ago on Wednesday 15 December 2021 02:35:28 AM IST.
Package yum-utils-4.0.21-3.0.1.el8.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!

Step 3 : Add Docker Repository by using the below command

 [root@linuxhelp ~]#  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

Step 4 : Install Docker packages by using the below command

[root@linuxhelp ~]# yum install docker-ce docker-ce-cli
Last metadata expiration check: 0:10:54 ago on Thursday 16 December 2021 09:37:34 AM IST.
Dependencies resolved.
============================================================================================================================================
 Package                             Architecture     Version                                             Repository                   Size
============================================================================================================================================
Installing:
 docker-ce                           x86_64           3:20.10.12-3.el8                                    docker-ce-stable             22 M
 docker-ce-cli                       x86_64           1:20.10.12-3.el8                                    docker-ce-stable             30 M
Installing dependencies:
 container-selinux                   noarch           2:2.167.0-1.module+el8.5.0+20416+d687fed7           ol8_appstream                54 k
 containerd.io                       x86_64           1.4.12-3.1.el8                                      docker-ce-stable             28 M
 docker-ce-rootless-extras           x86_64           20.10.12-3.el8                                      docker-ce-stable            4.6 M
 docker-scan-plugin                  x86_64           0.12.0-3.el8                                        docker-ce-stable            3.7 M
 fuse-overlayfs                      x86_64           1.7.1-1.module+el8.5.0+20416+d687fed7               ol8_appstream                72 k
 fuse3                               x86_64           3.2.1-12.0.3.el8                                    ol8_baseos_latest            51 k
 fuse3-libs                          x86_64           3.2.1-12.0.3.el8                                    ol8_baseos_latest            95 k
 libcgroup                           x86_64           0.41-19.el8                                         ol8_baseos_latest            70 k
 libslirp                            x86_64           4.4.0-1.module+el8.5.0+20416+d687fed7               ol8_appstream                70 k
 slirp4netns                         x86_64           1.1.8-1.module+el8.5.0+20416+d687fed7               ol8_appstream                51 k

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

Total download size: 90 M
Installed size: 377 M
Is this ok [y/N]: y
Downloading Packages:
 

Step 5 : start the Docker services by using the below command

[root@linuxhelp ~]# systemctl start docker

Step 6 : Enable the Docker service by using the below command

 [root@linuxhelp ~]# systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.

Step 7 : check the Docker status by using the below command

 [root@linuxhelp ~]# 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 Thu 2021-12-16 09:55:32 IST; 27s ago
     Docs: https://docs.docker.com
 Main PID: 10910 (dockerd)
    Tasks: 7
   Memory: 30.5M
   CGroup: /system.slice/docker.service
           └─10910 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Step 8 : Download and Run the Docker image from Online Docker Library

 [root@linuxhelp ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete 
Digest: sha256:cc15c5b292d8525effc0f89cb299f1804f3a725c8d05e158653a563f15e4f685
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/

By this the installation of Docker on Oracle Linux has been completed

FAQ
Q
Does Docker have OS images?
A
Yes, its have OS images.
Q
Which command is used to create a Docker image from a Dockerfile?
A
"docker build" is the command that is used to create a Docker image from a Dockerfile.
Q
Is it possible to create Docker image?
A
Yes, This script is called a Dockerfile.
Q
What is a Docker Container?
A
A Docker container is a virtualized run-time environment where users can isolate applications from the underlying system.
These containers are compact, portable units in which you can start up an application quickly and easily.
Q
What is a Docker Image?
A
A Docker image is an unchangeable file that contains the source code, libraries, dependencies, tools, and other files needed for an application to run.