The traditional way a business operates is by running only one application on one server. One reason to run a server with a single application is because the operating system such as Linux doesn't have the capability to run multiple applications securely on a single server. This causes a lot of money wastage to a company because they would have to buy a new server to run other applications and applications couldn't take full advantage of the server's capability.
To solve this kind of issue, the Virtualization and Containerization concept was introduced. Let's take a look at the concept of virtualization before we move to Containerization.
Virtualization
Virtual machines allow multiple applications to run on a single server. For example, let us take a company that had 3 servers to run one application each. Now with the help of virtualization, these 3 applications can run on a single server by creating 3 virtual machines. To build a virtual machine we need following
- First, we need hardware such as a server.
- second we need software called Hypervisor.
- on top of a hypervisor, we have virtual machines where each virtual machine has its own software like Windows, Linux, Unix, etc.
- On the topmost layer, we have the applications that these Virtual machines are going to run.
A hypervisor allows one machine to run multiple virtual machines and it controls the sharing of machines hardware. This solves the problem of money wastage but it has its disadvantages like
- it consumes a lot of disk space because each virtual machine has its own dedicated operating system.
- consumes a lot of RAM and CPU power
- they are slow to start. Because they have separate operating systems they take time to boot up.
To solve issues of Virtualization the concept of Containerization was introduced
Containerization
Containers are similar to virtual machines(VM). the major difference between them is that VM simulates the entire machine whereas container contains only applications. A container is an application that has been packaged with all files, configurations, and dependencies necessary for it to run. The leading software that was used to create, manage, and run containers is docker.
The major difference between VM and Containers is each VM contains an individual operating system whereas applications in containers share a common operating system(OS). let's say the development team has built a project and given it to the testing team to test it. sometimes the testing team will not to able to run the project on their machines because dependencies and libraries that are installed on their system are different from what the development team has installed in their personal system. With Docker, we can create images and make containers easily. These images will give the correct dependencies and versions. To build a container we need the following setup.
- first, we need hardware such as a server.
- on top of the server, we had an operating system such as Linux.
- on the above OS layer, we have a container engine. The container engine was used to unpack the container files and handle them off to the operating system.
- finally, we have applications that we want to run.
Advantages
- They are smaller in size.
- they are lightweight.
- take less bootup time.
- consume less RAM and CPU power
Disadvantages
- containers must packaged to work with the same operating system of the server(for example if the server operating system is Linux then files in the container should be Linux-based).
- Since there is one common operating system, if the OS crashes then the containers will go down
Hope this information was useful. Thank you :)