How To Install Docker In Rhel 8

Docker is a tool that allows you to easily build, test and deploy applications smoothly and rapidly using containers. It has gained widespread popularity in recent times due to the portability to run applications anywhere irrespective of the host operating system.
Docker provides a more efficient and lightweight environment to deploy the application. Docker uses Kernel's features such equally cgroups and namespace to run a container on a single os instance.
In this post, you will larn how to install Docker on Rocky Linux 8 / CentOS eight / RHEL eight.
Docker is now available in two editions,
- Community Edition (CE)
- Enterprise Edition (EE)
Here, we volition install Docker Comunity Edition (CE).
Prerequisites
Uninstall Older Version
Uninstall older versions of Dockers, named docker or docker-engine along with associated dependencies.
dnf remove -y docker-mutual docker container-selinux docker-selinux docker-engine
Do not worry about the contents inside /var/lib/docker/, all will be preserved.
Install Dependent Packages
Then, install the required packages.
dnf install -y lvm2 device-mapper device-mapper-persistent-data device-mapper-upshot device-mapper-libs device-mapper-upshot-libs
Add Docker Repository
Let'due south add the Docker community edition repository for the Docker installation.
dnf install -y dnf-utils dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install Docker on Rocky Linux 8 / CentOS eight / RHEL 8
Install Docker packages using the below command.
dnf install -y docker-ce docker-ce-cli containerd.io
You can also install a particular version of Docker CE by appending version like docker-ce-[version]
Due east.g. yum install docker-ce-19.03.5-3.el7
You lot can list the available Docker versions with yum list docker-ce –showduplicates | sort -r
Now yous have Docker installed onto your machine, start the Docker service in case if it is not started automatically later the installation
systemctl start docker systemctl enable docker
Check the Docker service.
systemctl condition docker

Verify Docker Installation
Once you outset the Docker service, you can run a simple "Hello Globe" container to verify the installation.
docker run -it rockylinux/rockylinux echo Hello-Globe
When you run the docker run command, the Docker creates and starts the container with the base image of Rocky Linux.
Since we are running centos container for the starting time time, the output volition await like below.
Unable to find image 'rockylinux/rockylinux:latest' locally latest: Pulling from rockylinux/rockylinux 1b474f8e669e: Pull consummate Assimilate: sha256:8122f31fbdd5c1368c6b7d5b9ae99fec2eb5966a5c967339d71e95c4a3ab7846 Status: Downloaded newer image for rockylinux/rockylinux:latest How-do-you-do-World
At first, the Docker looks for Rocky Linux image locally, and if it is not institute, information technology starts downloading the Rocky Linux epitome from the Docker registry (one fourth dimension). Otherwise, it uses the already downloaded Rocky image.
Once the image has been downloaded (in our case), it will start the container and echo the command Hello-World in the console which you tin can see at the terminate of the output.
Let Not-root access
Past default, just users with root or sudo (root) privilege can run Docker containers. To let non-root users to run Docker containers, you can follow the below steps.
Create a grouping called docker if it does non exist, run the following commands with root privileges.
groupadd docker
Add a user that is to be a part of the docker group. Replace raj with your username.
useradd raj
Add a user to the docker group.
usermod -aG docker raj
Now you lot can run a Docker with a non-root user.
Interested Topics
Docker Basic Topics
1: Top Important Docker Commands – Working with Docker Containers
ii: Working with Docker Images – Building Docker Images
3: How to Build Docker Images with DockerFile
Docker Advanced Topics
i: How to Setup Docker Private Registry on CentOS seven
ii: How to Install and Configure Docker Swarm on CentOS seven
Determination
That's All. I hope you have successfully installed Docker on Rocky Linux eight / CentOS eight / AlmaLinux. Please share your feedback in the comments department.
Source: https://www.itzgeek.com/how-tos/linux/centos-how-tos/how-to-install-docker-on-centos-8-rhel-8.html
Posted by: moorehichat.blogspot.com
0 Response to "How To Install Docker In Rhel 8"
Post a Comment