All the basics you need to start Docker
How to Build Tiny Container Homes for Your Data and Programs
What is Docker?
Docker in simple words is a tool used for creating and managing containers.
Containers? What are they?
A container is a package of source code and its dependencies to run that code. Each container is isolated, so it doesn't affect other containers.
The same container always yields the same application and execution behavior, no matter where or by whom it might be executed.
A container is analogous to a picnic basket, it has all the food necessary to eat and also dishes (plates) to eat.
Okay, but why should we care about Containers?
Environment (env): The runtimes. languages, and frameworks you need for development.
In large-scale projects, often the Development env and Production env are not the same, causing version conflicts, tools conflicts, OS conflicts, etc.
This led to a historic dialogue "It works on my computer, but not on the Production machine". Meanwhile, Docker laughing in the corner.
To add to this, we often have different environments within the same team. Clashes again!
We want to build and test in the same environment as we later run our app. Uninstalling and re-installing local dependencies is a solution, but not a feasible one.
Virtual Machines to the rescue !!!
The concept of Virtual machines is to allow you to run multiple operating systems on one physical computer. It uses software known as Hypervisor, which manages these instances of Virtual machines.
All the system resources are shared among these virtual machines.
But, Virtual Machines have some downsides:
For each project, that requires isolation, a new VM instance is to be created. Thus performance can be slow, as Guest Operating System consumes a lot of space.
Let me welcome, Docker.
Docker is more lightweight and efficient than virtual machines (VMs) because it uses the host operating system's kernel and shares the host system's resources, whereas VMs run on their operating system and have their own set of resources.
This means that Docker requires less overhead and can start up faster than VMs. Additionally, Docker containers are portable and can be easily moved between different environments, whereas VMs are tied to a specific host and can be more difficult to move.
The confusion between Images and Container
Consider a situation where you need multiple copies of a project ( eg: multiple instances of a server). As a brute force approach, you create a new folder and copy the required contents (code + data) from the existing project.
Let us think optimally. consider a file that produces an instance of the project when it is run. By this, you can create any number of instances, based on your requirement. This is the concept of Images. Images are like blueprints for containers, which run to produce containers.
To be really, I had a lot of confusion regarding the difference b/w both. After some research, I got the complete picture. I tried to present it to you in the simplest manner.
Thank You ❤️
Damn, you've reached this point 🥳👏. This shows that you are a keen learner🔥. Now do not stop here. There is much more to learn in Docker.
Writing blogs is not as simple as we think 🥲. It requires planning, resources, understanding and most importantly TIME🧑💻. I would be very much grateful if you could just share this blog post with your fellow peers (Linkedin, Facebook, Whatsapp, etc). Thank You ❤️
Other Valuable Posts
Git 101: Shell Commands Mastery (hashnode.dev)
All the basics you need to start working with Git (hashnode.dev)