In today’s guide lets jump into Docker containerization technology. Docker is an open source software which helps to set up with Container as a service (CaaS). It will covert the operating system as a virtualization platform to run with N numbers of Containers.


Articles related to Docker Series:
  1. How to install Docker on Red Hat Enterprise Linux and CentOS Linux 7
  2. How to search for docker images and launch a container
  3. How to connect Docker containers and expose the network
  4. How to manage Docker containers

There are two different editions available in docker. They are

  • Community Edition (CE)
  • Enterprise Edition (EE)

Docker CE is free to use, Our setup will use with CE. Docker EE is same as CE, but it included with commercial support from docker.

Now you may ask what is Container?

Containers are lightweight and they are packed with required libraries to run any applications. Absolutely they are not a Virtual machine.

What is the difference between Virtual machines and Containers?

Virtual machines are built on top of Virtualization software. To have a virtual machine first we need to get a Physical server and install with Virtualization software, on top of it Virtual machine will be created. To deploy with anyone of application we need to create individual virtual machines by defining resources to each VM’s.

Physical Machine –> Hypervisor –> Virtual Machine –> Operating System –> Application

Containers are built on top of the base operating system. We need a physical machine or virtual machine to run a container by installing docker package. We can run any numbers of containers in the same host where docker daemon running on it.

Physical Machine –> Operating System (With Docker) –> Containers

Look at below figure to get more idea how Docker differ from Virtual Machines.

Docker vs Virtual Machines

Docker vs Virtual Machines



Let’s start to install the Docker. This guide not limited to installing only on RHEL and CentOS its applied for Oracle Linux and Scientific Linux too.

Step 1: Enable docker repositories.

Its good idea we need to install docker from the official repository to resolve all dependencies. Download and save the repo file under /etc/yum.repo.d/.

# cd /etc/yum.repos.d/; curl -O https://download.docker.com/linux/centos/docker-ce.repo

 

Download the docker repo file

Download the docker repo file

 

Step 2: Install the Docker package

Now list and verify the repository or just install with the docker package.

# yum repolist
# yum install docker-ce -y

 

Docker installed

Docker installed



Step 3: Start and enable Docker service persistently

Once we have done with installation start and enable the docker service

# sudo systemctl start docker
# sudo systemctl enable docker

 

Start docker service and enable service

Start docker service and enable service

 

Step 4: Grant non-root user to run privileged docker commands.

To run the docker commands from unprivileged accounts we need to add the user account in docker group.

In our setup “babinlonston” is the user need to run all docker related commands. Add him to docker group so that he has all privileges to run the docker related commands without switching into the root.

# sudo usermod -aG docker babinlonston

 

Step 5: Run a few basic Docker commands

Now, let’s verify docker status and version information by running few basic commands.

To print the docker version run

# docker -v

 

To getting the status information in brief run with

# docker info




Docker basic commands

Docker basic commands

 

That’s it we have completed with installing Docker in RHEL based servers.

Conclusion:

We have seen how to enable with a containerization service by installing Docker. It provides CAAS upon installing a package, we can manage micro-services easily than before. It helps developers work more super easy by build, ship and deploy. Let’s continue more topic on docker till then subscribe to our newsletter to receive the up-to-date posts.

Babin Lonston
Overall 13+ Years of experience in IT field, 7+ years of experience in Linux administration with Virtualization & Cloud technologies. Love documentation and being Numismatics for a long time.

Change systemd Linux servers network interface name ensxx to eth0

Previous article

Creating DNS zones and DNS records in IPA Server

Next article

You may also like

Comments

Leave a reply

Your email address will not be published.