Install Docker on CentOs 8 / Rocky 8

Docker

What is Docker?

Docker is an open-source project that automates the deployment of software into portable, self-contained containers that may operate on-premises or in the cloud.

To comprehend what Docker is and what it accomplishes, you must first comprehend the distinction between a Virtual Machine and a Container.

As the name implies, a virtual machine (VM) is a virtual image or partition that, as closely as feasible, emulates a complete, distinct system – that is, it has its own (virtual) CPU, memory, and frequently (virtual) peripherals. As a result, it requires its own operating system by definition.

However, in order to deceive the OS into believing it is operating on a real (rather than virtual) machine, another component must sit between the OS and the HW and intercept OS calls that must be mediated (such as calls that might cause a crash in another VM, or damage or corrupt shared resources, etc.).

A hypervisor is the other component, It will do things like map physical RAM to virtual RAM, manage registers, and so on.

Docker, on the other hand, utilizes operating system characteristics, which allow the underlying operating system to divide access to resources and processes as a distinct environment, which is (roughly) what a container is. And it’s lighter than using Hypervisor-VM’s architecture:

Installation steps

Repo extras must be enabled. By default is enabled, but check before starting.

yum repolist

Uninstall older versions if exist. If you’re doing this on a fresh OS, you can skip.

yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

Setup the repository:

Install the yum-utils package (which provides the yum-config-manager utility) and set up the stable repository.

yum install -y yum-utils
yum-config-manager \
 --add-repo \
 https://download.docker.com/linux/centos/docker-ce.repo

Install Docker engine:

yum install docker-ce docker-ce-cli containerd.io

If prompted to accept the GPG key, verify that the fingerprint matches 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35, and if so, accept it.

Start Docker

systemctl start docker

Start Docker on boot

systemctl enable docker.service
systemctl enable containerd.service

Test Docker engine installation by running the default image “Hello World”

docker run hello-world

DONE!

Now you have the Docker engine running on your server! Exciting!

You may get more optional post-installation info for Linux in the Docker documentation.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.