Virtual Machine
But before getting to know about what virtual machine and virtualization is...
A VM is a digital version of a physical computer.VMs software can run programs and operating systems, store data, connect to networks, and do other computing functions, and requires maintenance such as updates and system monitoring.
Let's suppose a scenario, the developer team built an application and send it to the testing team for various tests but the testing team replied by saying the usual stuff "it's not working on our machine" and the developer team replied the same "works on our machine".This case with the testing team occurs due to the lack of supported software and dependencies of that application which were present in the developer team's system. This not only delays the overall time to build the application but also brings in conflicts between teams.
Without Docker
Before entering the discussion that how docker ended this conflict, let's see how without docker it was resolved up to an extent. Here is what the developers can do, along with sending the application's code to the testing team, they can also send the required software. But this also didn't work as some files are bound to the developer team's operating system. So the only option left here is that the developer team sends the (code+dependency software+operating system). But sharing OS is not a cakewalk as it has some disadvantages as well:
Consumes many resources
Requires high specs of the hardware
Reliability problems and many more.
Virtual Machines solved these problems to an extent.
As we see in the image the hypervisor will virtualize the environment and these 3VMs get created(can be more). Now the developer will work on any of the VM and will share the VM with the testing team and the problem gets solved...BUT BUT BUT!!!!
The main question is that if everything was sorted then why there was a need to shift from virtualization to containerization?
Virtualization or Containerization?
The above question in itself is wrong as Containerization is a form of Virtualization. As, virtualization aims to run multiple OS instances on a single server, whereas containerization runs a single OS instance, with multiple user spaces to isolate processes from one another. Neither a virtual machine nor a container can address all issues simultaneously.
The problem with VMs was that they are less efficient than real machines because they access hardware indirectly. Running VM software on top of the host operating system means that it will have to request access to storage and memory from the physical device.
In some cases, the virtual machine's demand is greater than its resource entitlement. When this occurs, the virtual machine doesn't receive enough CPU or memory resources. So docker saved this problem of ours by containerization, although it's a form of virtualization. Unlike VMs, containers do not have an OS within them. They simply share the underlying kernel with the other containers.
What is a container?
A container is a portable computing environment. It contains everything an application needs to run, from binaries to dependencies to configuration files. Containers operate on an abstracted layer above the underlying host operating system. Some of the most common reasons developers decide to containerize are:
Portability
Efficiency
Agility
Faster delivery
Improved security
Faster app startup
Easier management
Flexibility
Docker
Let's bring docker in this picture. Docker is a software platform that allows you to build, test, and deploy applications quickly. It uses containers on the host OS to run applications. Is a tool that performs OS-level virtualization or we can say containerization.
Docker is a set of platforms as a service(PaaS) that uses operating system-level virtualization whereas VMware uses hardware-level virtualization.
Advantages of Docker
No pre-allocation of resources
Docker enables you to build container images that can be forwarded to every step in the deployment phase of the application
Less costing
Light weight
The image can be reused once requested from the docker hub by the docker engine
Takes less time to spin up a container.
Disadvantages of Docker
Docker is not a good solution for applications that require rich GUI
It is difficult to manage a large number of containers
Docker does not provide cross-platform compatibility i.e if an application is designed to run in a docker container on windows, then it cannot run on linux docker container
Docker is suitable when the development OS and testing OS are the same
It does not provide any solution for data backup and recovery.
Next blog will be about docker architecture and other docker componetns. Do like the blog and share it.