In today’s guide lets jump into Docker containerization technology. It 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 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
  5. Managing Docker data persistently by attaching a volume

There are two different editions available. 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.

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 of 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 repo file
Download the docker repo file

Step 2: Install the Docker package

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

# yum repolist
# yum install docker-ce -y
Docker installed
Docker installed

Step 3: Start and enable the service persistently

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

# sudo systemctl start docker
# sudo systemctl enable docker
Start service and enable service
Start docker service and enable service

Step 4: Grant non-root user to run privileged 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 commands without switching into the root.

# sudo usermod -aG docker babinlonston

Step 5: Run a few basic commands

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

To print the version run

# docker -v

To getting the status information in brief run with

# docker info
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 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 14+ 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.