Docker Tutorial for beginners
Part One: Introduction to Containerization and Docker
1 - What is Containerization ?
Containerization is packaging up your product (software, web app ... etc) with all its dependencies in a self-contained package so that it can be run uniformly and consistently on any infrastructure without going through troublesome setup process example: missing dependencies... etc.
2 - The Need for Containerization:
"That's weird; it's working fine on my machine"
Let's take a real life example, weeks ago, we have developed a travel scheduling app that can store information about trips, clients and the billings, and also can show you the different place that you can visit, awesome hah!
To implement that we need some dependencies to be installed, for example:
Installing node.js and Express.js is really simple, anyone can do it, but how about Redis, it's really a pain in the ass for a beginner. let's assume that you succeeded into installing all those tools, okay that's cool.
But you are working with a group, you are using Linux, and for sure there's someone from your teammates who use Windows, another problem came up, Now you have to consider the inconsistencies of how these two different operating systems handle paths, Or the fact that popular technologies like Nginx are not well optimized to run on Windows. Some technologies like Redis don't even come pre-built for Windows.
Even if you get through the entire development phase, what if the person responsible for managing the servers follows the wrong deployment procedure?
All these issues can be solved if only you could somehow:
Develop and run the application inside an isolated environment (known as a container) that matches your final deployment environment.
Put your application inside a single file (known as an image) along with all its dependencies and necessary deployment configurations.
And share that image through a central server (known as a registry) that is accessible by anyone with proper authorization.
Your teammates now, will be able to download the image from the registry, run the exact same application within an isolated environment (container) free from the platform specific inconsistencies, or even deploy directly on a server, since the image comes with all the proper production configurations. How awesome is that!
To conclude, the idea of containerization is to put your application inside a self-contained package, making it portable and reproducible across various environment and infrastructure, it's like putting your product inside box and give it to everyone who want to use it wherever he is and whenever he wants.
3 - What is Docker:
Docker is an open-source containerization platform that allows you to containerize your applications, share them using public or private registries, and also to orchestrate them.
Now, Docker is not the only containerization tool on the market, it's just the most popular one.