Saturday, October 31, 2020

How to Install Docker on RHEL 8 (Red Hat Enterprise Linux)

Must read

How to Setup a Firewall with UFW on Ubuntu 20.04

Nowadays, a Firewall is an essential utility and property of any system for security; by default Ubuntu Operating system having a firewall...

How to Install Ruby on Ubuntu 20.04 Linux

Nowadays, Ruby is the most popular language, especially for SaaS application development. It has a perfect and elegant syntax structure, and it...

How to Install Eclipse IDE on Ubuntu 20.04 Linux

Eclipse is the most famous and widely used Java integrated development environment (IDE). It supports many plugins to enhance the capabilities to...

The 30 most useful Linux commands

This article will introduce some practical and common Linux or Unix command , which is the Linux system administrators normally use the command . This article is not a...
SATISH KUMAR
I am Satish Kumar, Founder of LinuxConcept. Linux and F.O.S.S enthusiast, love to work on open source platform and technologies.
- Advertisement -

Docker is an application use to simplify the application management process in containers, where containers use to run the application with the resource-isolated process. Docker allows you to build, test and deploy an application to run virtually anywhere.

It is similar to a virtual machine, more flexible, more resource-friendly, more portable, and more host operating system dependent. It is use to run a single application with a platform environment which includes everything needed by software to run.

- Advertisement -

Nowadays, Docker known as a modern software management platform includes DevOps continuous integration, deployment and production management.

In this tutorial, you will learn to install Docker on an RHEL 8 Linux system.

Docker packages are available under the Red Hat repositories, but it may not have the latest version. So, we will install the latest Docker here by using Docker’s official repositories.

Installing Docker on RHEL 8 Linux

The Docker installation on Red Hat system or server is straightforward, enable the Docker repository and install packages.

In the first step, we will update the package list and install the dependencies required to add new HTTPS repository:

- Advertisement -
$ sudo yum update
$ sudo yum install yum-utils device-mapper-persistent-data lvm2

Now, add Docker’s stable repository using the below command:

$ sudo yum-config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo

Now, the Docker repository enabled in your system; you can install any version of Docker that is available in the current repositories.

Install latest version of Docker

To install the latest version of Docker you can use the below command, but if you want to install any specific version of Docker to install, you should skip this and go to the next one.

- Advertisement -
$ sudo yum update
$ sudo yum install docker-ce

After successful installation, Docker service will start automatically. To verify the Docker service status use following command:

$ sudo systemctl status docker

The output should look like below:

output:

● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2020-05-21 14:47:34 UTC; 42s ago
...

Execute Docker Commands as a Non-root user or without sudo

The Docker commands are executable by only root user and a user with sudo privileges.

If you want to execute Docker command by a non-root user, first you need to add that user to the docker group that created during Docker CE package installation.

You can add a user in the docker group using the following command:

$ sudo usermod -aG docker $USER

You should replace “$USER” with the username.

Create a new user session to refresh the group membership, and the user is ready to execute the docker command.

Verify Docker Installation

To verify the Docker installed in the system, you can execute the docker command without sudo, and we’ll run a test container:

$ docker container run hello-world

The above command will download a test image if it is not available locally. After downloading run it in a container, print a “Hello from Docker” message and exit.

You will get the output similar to below:

This test container will stop after printing the message, as it is not having a long-running process.

Docker commands pull images from the Docker Hub; it is default cloud-based Docker’s registry service which has all other functionalities including stores Docker images in Private and Public repositories.

Uninstalling Docker

To uninstall Docker from the machine, always remove all containers, images, volumes, and networks.

You can stop all running containers and remove all docker objects using the following commands:

$ docker container stop $(docker container ls -aq)
$ docker system prune -a --volumes

Now, you can uninstall Docker package like any other packages from the Red Hat system using the apt package manager:

$ sudo yum purge docker-ce
$ sudo yum autoremove

Conclusion

Now, you have learned to install Docker on RHEL 8 Linux machine and also learned to execute docker command and run a docker container. You can learn more about docker by following official Docker documentation.

If you have any questions related to docker, please leave a comment below.

- Advertisement -
- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Subscribe to our newsletter

To be updated with all the latest news, offers and special announcements.

Latest article

How to Setup a Firewall with UFW on Ubuntu 20.04

Nowadays, a Firewall is an essential utility and property of any system for security; by default Ubuntu Operating system having a firewall...

How to Install Ruby on Ubuntu 20.04 Linux

Nowadays, Ruby is the most popular language, especially for SaaS application development. It has a perfect and elegant syntax structure, and it...

How to Install Eclipse IDE on Ubuntu 20.04 Linux

Eclipse is the most famous and widely used Java integrated development environment (IDE). It supports many plugins to enhance the capabilities to...

The 30 most useful Linux commands

This article will introduce some practical and common Linux or Unix command , which is the Linux system administrators normally use the command . This article is not a...

How to Reset the MySQL Root Password

Do you want to reset the MySQL root password? Sometimes we forget the root password and not able to log in on...