Hey there👋 Let’s understand the basics of Virtualization which is like a pre-prerequisite to learn before docker. Whether you're a tech newbie or a seasoned pro, I'm here to break it down for you in a fun and easy-to-understand way! 😎
Docker: Simplifying containerization
Docker is represented by a logo with friendly looking "whale” as you know that carries containers.
Docker is an ‘open-source tool’ that facilitates deployment of applications inside the software containers.
It’s just similar to “fishes in a bucket”. Applications (fishes) are deployed inside the containers(bucket).
- Container is like a Virtual Machine.
History of Docker's Evolution🐳:
Let's say a developer finished working on some code. When the code is sent to the testing team, it doesn't run. What's the problem? The developer had all the necessary dependencies for the code to work, but the tester didn't. Virtualization solves this issue.
Let’s understand how this issue was solved with Virtualization. 😎
Virtualization (Pre-Docker era):
Virtualization is a technology that transforms hardware into software.
or you can also say, It is the technique of splitting and adding the physical resources into as many as logical resources we want.
We have Hardware that includes the CPU, storage, memory and Networking. On top of this layer, we have a Hypervisor which is like a Kernel.
Hypervisor is a tool that turns physical resources into virtual ones, allowing us to create virtual machines by allocating resources from the hardware.
Now, we can send the Entire VM to the testing team after development team worked on it in the form of Image.
Drawbacks of Virtualization:
A Virtual Machine (VM) uses the space allocated to it, meaning it reserves some space right from the start when it is created.
If the allocated space is not used, it goes to waste.
We cannot scale, means we cannot increase or decrease the space allocated from the hardware.
Due to space limitations, we can't create more VMs, but Docker overcomes all these problems.
The Birth of Docker (2013)🐳
Docker was 1st release in March 2013. It is developed by ‘Soloman Hykes’ & ‘Sebastian pahl’.
Docker is an Open-source Centralized platform designed to create, Deploy and run the applications.
Docker is a tool is a Platform as a service (PAAS) that performs O.S level Virtualization whereas VMware uses Hardware level Virtualization.
As you can see below, Docker uses the Host O.S to run applications. It allows applications to use the same Linux kernel as a system on the host computer, rather than creating a whole virtual O.S.
We can Install docker on any O.S but Docker engine runs natively on Linux distribution.
Docker is written in “go” Language.
Docker Advantages:
No pre-Allocation of RAM
Light in weight
Scalable
Low cost
Consumes less time to create containers.
You can reuse the image.
Docker Components:
Docker Client🖥️:
Docker users can Interact with Docker Daemon through client. We write commands on the client terminal, that sends these commands to the docker daemon. It is possible for the docker client to communicate with more than one daemon.
Docker Daemon🐳
Docker Daemon runs on the Host O.S. It is responsible for running Containers to manage docker services. Docker Daemon can communication with other Daemons.
Docker Host🚀
Docker Host is used to provide an Environment to execute & run applications. It contains the Docker Daemon, Containers, Images, Networks & Storages.
Docker Hub/Registry🖥️
Docker Registry manages & stores the docker images.
They are 2 types of Registries in the docker.
Public registry: also known as Docker hub
private registry: used to share images within enterprise.
Let’s add a Analogy to understand this image,
Consider you are going to cook a recipe, recipe is similar to Docker file; and once the meal is prepared, its Docker image and once you serve it, its Docker container.
Docker file (Recipe)🤩
Docker file has a set of instructions of applications environment, its dependencies and configurations by the developer to build the image.
Docker image (Prepared dish)🤩
Images are read only binary templates used to create containers. It is a single file with all dependencies & configuration required to run a program. Image can be reused.
Ways to create image:
Create image from Docker file
Create image from existing container
Take image from Docker hub
Docker container (Serve the dish) 🤩
Container is like a Virtual Machine. Container holds the entire packages that is needed to run the application.
Image is a template & container is copy of that template and image when running becomes container.
Conclusion🎉:
Docker is an interesting tool that is used by the developer to create, run and deploy application quickly. Evolution of Docker explains that why docker is used now as there was also the virtualization concept before. You will learn where virtualization lacks that was overcome by Docker and has become popular. Obviously, when docker is so popular knowing its components through an Analogy makes your learning memorable.
Happy Learning! 🎉