An Introduction to Dockers and Containers
Early days, developers used 2 separate physical servers such as web and application to deploy their web applications. But here, all memory and other features may not be used totally which implies this is not 100% utilizable. As a solution for this hypervisors were introduced.
Web Application Deployment with Hypervisor
A hypervisor or a Virtual Machine Monitor (VMM) allows one hardware to host multiple virtual machines by sharing the common hardware resources such as memory, processing power, etc. Mainly there are 2 types of hypervisors called type 1 and type 2.
As per figure 1, the hypervisor is installed on top of a high processing hardware box or a physical server, and separate virtual machines are installed on top of this. Inside each virtual machine, an operating system and the application are installed. Usually, a separate virtual machine is allocated for a specific application such as application, web, load balancer, proxy, etc.
The hypervisor solves the wastage problem of application deployment but we still have some problems to solve regarding this. Here we have to pay attention to the licensing, patching, and maintenance of each separate operating system. As a solution for that containerized application concept has come into the picture.
Containerized Applications
Here, this has solved the multi OSs problem. Because of that, we do not need to worry about the licensing, patching, and maintenance of each separate operating system. Refer to figure 2.
Here, we only install a single operating system on top of the physical layer. Again, we do not need to start a separate OS for a single deployment of an application because the OS is already started. The dockers or the containers are deployed on top of the docker engine.
When we talk about dockers, the following terminologies should be taken into consideration.
Docker
This is an open-source project which allows the creation of containers and container-based applications.
Docker File
Docker files are used to write commands to build docker images.
Docker Image
This is built using the created docker file. Docker image is a read-only template that includes the instructions that will be used to create containers on top of the Docker engine.
Docker Container
This wraps the application that needs to run by including all the things that will support it to run.
Docker Engine
Dockers are run on the docker engine. This is responsible for managing containers, images, and much more. When we talk about the docker engine, there are 2 important terminologies.
- Docker Registry: Docker registry is the place to store the docker images. There are many registries to store the docker images such as Amazon, Microsoft, etc. but the docker hub is the biggest among all.
- Orchestration: Here, when we have several micro-level services or processes, we can create separate containers for each service. After that, using all these containers can move towards a common goal. Kubernetes is used to continue this orchestration. Previously this was built by google but now this is an open-source project.
Additional Points about Dockers
- Containers or dockers are not equal to hypervisors.
- Dockers are persistent which implies, the things you did before the shutdown will not be lost after the shutdown.
- When using dockers in microservices, it is better to create separate and independent containers for each service.
References
- https://www.youtube.com/watch?v=cUiU8yDdQmw&list=PLD-mYtebG3X9HaZ1T39-aF4ghEtWy9-v3&index=1
- https://www.docker.com/resources/what-container
- https://www.oracle.com/it/cloud-native/container-registry/what-is-docker/
- https://www.freecodecamp.org/news/a-beginner-friendly-introduction-to-containers-vms-and-docker-79a9e3e119b/