Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
March 17, 2022 04:42 pm GMT

What Is Docker And Why Do We Need It?

In this article, we shall be going through a brief introduction to what Docker is and why we need it. But first, lets define the problem statement and see how Docker solves it

The Problem Statement

Lets consider that youre working on an application which requires multiple technologies to be used for developing the different components like the Frontend, Backend, Database etc Everything seems to be good, but while youre working with all these technologies on your machine, most often there arises a problem where one technology needs one version of a dependency and some other technology needs a different one to work. Adding to this, it might also happen that your application may not work the same way on someone elses machine or when you deploy it to different environments with different OS or hardware, it fails to run.

In order to solve all these frequent problems we use something called virtualization, lets discuss this in more detail

The Solution: Virtualization

Virtualization is a process whereby a software is used to create an abstraction layer over computer hardware that allows the hardware elements of a single computer to be divided into multiple virtual computers. The main idea of virtualization would be to isolate the components of our application and their dependencies into individual self-contained units that can run anywhere without any dependency or OS conflicts.

Now that we know what virtualization means, we can use it in order to solve our above stated problem. There are two ways to achieve this by leveraging the concept virtualization:

1. Virtual Machines
A Virtual Machine is essentially an emulation of a real computer that executes programs like a real computer. Virtual machines run on top of a physical machine using a Hypervisor. A hypervisor, in turn, runs on a host machine.

A Hypervisor is a piece of software, firmware, or hardware that a virtual machine runs on top of. The host machine provides the virtual machines with resources, including RAM and CPU. These resources are divided between virtual machines and can be distributed based on the applications that run on individual virtual machines.

Image description
Even though, virtual machines have solved the problem by now making our applications to run in isolation, with their own set of dependencies/libraries and OS requirements, the main issue here is that theyre very heavy since each virtual machine has its own Guest operating system thereby consuming a higher portion of the host machines resources and so take up a lot of time to start or create. This is where containers come to the rescue.

2. Containers
Containers are a light-weight, more agile way of handling virtualization, and since they dont use a software like hypervisor, you can enjoy faster resource provisioning and speedier availability of new applications. Unlike virtual machines which provide a hardware level virtualization, containers provide an operating-system level virtualization due to which theyre very simple and easy to work with.

Image description
Since containers are lightweight, they consume a lot less resources of the host machine compared to virtual machines. You can easily share containers while you work, and be sure that everyone you share with gets the same container that works in the same way irrespective of version conflicts between dependencies or OS.

Now, What is Docker?

Docker is a tool which helps in developing, shipping, and running your applications on containers and enables you to separate your applications from your infrastructure so you can deliver software quickly.

Image description
It provides the ability to package and run an application in an isolated environment i.e; containers. The isolation and security allows you to run many containers simultaneously on a given host.

Some basic Docker terminology

Docker Engine
The Docker Engine is the core containerization technology responsible for creating and managing all the containers and other Docker objects. It acts a client-server application consisting of:

  • The Docker Daemon, which is a daemon process that runs in the background, keeps listening for any API requests and manages the Docker objects accordingly
  • A set of APIs in order to communicate with the Docker daemon
  • The Docker CLI client which helps users to communicate with the docker daemon and carry out the users requests by using these Docker APIs

Docker Image
A Docker image is just a template which includes a set of instructions or commands that are used in order to create the actual container. We can use the same docker image to create multiple docker containers

Docker Container
A Docker container is the actual instance which is based off of an image, and packages all the dependencies, libraries that an application needs and runs it in loosely coupled isolation

References

Follow for more articles related to Docker and Software Engineering in general :)


Original Link: https://dev.to/ahmedgulabkhan/what-is-docker-and-why-do-we-need-it-5dje

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To