What is this docker anyway?
If you are a beginner in software development and the term docker is coming by you and you don’t really understand what it is but still, you behave as if you do, you are not alone my friend.
I remember the time I had to understand some of these DevOps concepts when deploying and testing my code, it was a complete nightmare. Not really because it is difficult but because it is DevOps, and I like development. Anyway, this article will guide you through the following points:
· What is docker?
· Why do we need it?
· What is it used for?
I will create a separate article and even a series following after this one to learn docker and use it. You can submit your email here to receive it in your inbox. https://subscribe.skillunga.com
In a software’s development life cycle, it goes through various phases. The phases vary from company to company but these are the main ones.
Development means developing the application itself, testing means testing it and breaking it to find bugs, and production means deploying it over to the server or wherever to be used.
Now, any software or application being developed has some dependencies and libraries that it makes use of. Isn’t it? These libraries or other dependencies again have further dependencies and thus lead to a huge file of dependencies only. These dependencies have different versions on different machines as well. I might have python 3.x and you might have python 3.y. Let's say I am the tester and you developed a code and gave it to me for testing. I downloaded all the libraries but in the end, it didn’t work because of a mismatch in versions. It works on your machine but not on mine. This blocks my work altogether and I cannot test the app if it is not running. Now I hear you when you say, “Can’t you just update to python 3.y boy.” And the problem with that is, I am a tester and I might have applications from other developers also depending on python 3.x 3.w 3.z and what not? So, what we need is an encapsulated environment that is complete in itself with all its libraries and dependencies installed and doesn’t affect other applications. This is where docker comes in!!
Not so fast though. The above problem was solved by using virtual machines before docker came in. Developers used to create OS images with their applications and libraries and everything installed and forward that complete operating system to the testing team. The testing team would then make appropriate changes and create another OS and forward that to the production team. It all worked fine just like a fairy tale.
But, the issue with this approach is it’s a complete OS. Considering only one application is okay, but for multiple applications, multiple OS images will be needed to be created, and eventually, we will have a problem with the size. This eventually makes them slow as well. And they are not portable enough given their high dependence on the host machine’s hardware.
Docker beats this issue by creating small containers of applications along with their libraries and dependencies which are highly portable and can be sent as “images” to other devs and other teams.
What docker does basically is pack the application together with its dependencies and create an image. This image can be used to create instances of the image, where each instance is a running version of the application. The instance will download all dependencies, most of which are available on the docker hub(the GitHub of docker where all images and libraries are present to be ported in docker). Docker thus solves the problem of portability of code very gracefully and without disturbing the other applications that might be present in the receiver’s machine. Docker uses a DockerFile to configure, create images, and launch instances from images. A subject for another day.
1. Matches the security of the OS approach.
2. Much faster as much smaller size as the OS kernel and other OS dependencies are not included.
3. Easier to run and share over docker hub.
4. Hardware independent.
No surprise that it has got quite famous in the developer community since its launch.
That’s all it is. Congrats you now know what docker is, and why do we use it.
Fact: It is believed to bring bad luck to not clap for an article that gives you so much knowledge.
The author of this post is not a very good juggler.