If you've heard the word Docker about a million times by now and have no clue what it is, then don't worry because by the time you finish reading this you'll have a clear idea of what it is and why you're hearing about it everywhere.
I think it'll be best to understand "what" Docker is by first getting to know "why" it exists in the first place. I'm sure you've heard of the classic long-running "But It Works On My Machine" programming joke.
This is the exact problem docker aims to solve.
There is often a mismatch of project dependencies and their versions between different systems running the code which can lead to unexpected problems. Docker solves this by creating an "isolated movable" environment. Let's talk about the two words I just used, "isolated" and "moveable".
Isolated means that your code's dependencies aren't affected by those already present (or absent) on the system running your code. For example, let's say you've node 12.0.0. installed globally on your system but the project your friend gave you to checkout uses node 13.0.0. If your friend "dockerizes" their app before send it to you then the app will "ship" with node 13.0.0. and use that regardless of even if you have node installed in your machine or not. Amazing, no?
Movable means that once your friend has "dockerized" their app, they can send this "dockerized" version to anyone without worrying and IT WILL WORK on their machine! No more needing to set up the dependencies for development on each machine every time.
Now that you have an idea of "why" docker exists let's move on to the "what". You might have noticed that I used the word "dockerized" a few times in the last two paragraphs. The obvious question popping up in your mind right now would be what does it mean to "dockerize" your app?
Not exactly like the one showed above but quite similar in concept :P
Remember the "isolated moveable" environment I talked about above? That along with your code is a container. To put it in a little more technical terms, a Container is a package of your code and all the dependencies required to run that code. Hence ensuring that if it works on one machine it works on all machines.
It's like having a portable kitchen with all the ingredients you require to make a dish. So that no matter where you take that kitchen or who uses it as long as it is the same kitchen with the same ingredients the dish can be cooked.
Okay but this still doesn't answer what docker is?!
Now that you've understood all this, you're ready for the final secret. The truth about Docker. Are you ready?
Docker is a tool to create and manage containers.
BAMM! Yes, it was this simple of an explanation. (though its a little more complex when it comes down to implementation :P)
To sum it all up:
Docker exists to simplify the process of creating and managing containers that are just "isolated movable" environments having your code.
I hope you now have a better idea of what Docker is and why it's gaining popularity everywhere.
Thanks a ton for reading :)
Reach out to me on Twitter to share your feedback or for any queries. I'd be more than happy to help!
This article is a part of a series called "Demystifying Docker" which I'm planning to write in the coming days. The aim of this series is not to provide a perfect technical take on Docker but to simplify it so that everyone can understand and use this amazing tool. I am by no means an expert on Docker but I sure love sharing the knowledge I struggled to acquire with everyone. If you liked this and are interested in the "how" you can begin using the Docker part, then feel free to follow me and keep a lookout for the next articles in this series.