Essences of The Container Technology
Before diving into The Docker and any other “container” technologies it is essential for us to understand the demand for that technology and grasp its philosophy.
-Seriously what is going on guys? everyone is a fan of the docker these days, what is that? and why?
Let me try to answer these questions.
What do we need to run a peace of software?
Not to worry, It’s not a philosophical question as it looks like :)
we simply need a peace of hardware and an operating system to be able to talk to hardware itself right? and the program itself of course that we’d like to run.
what if our program is operating system depended eg:linux, and our computer has windows in it, how can we run this linux depended program on a windows machine?
Virtualization technologies comes to the surface as an answer to that question.
You can install any os in your machine on the top of your os and virtualization software handles the rest of it.
the problem is solved right? just install the vm technology and load the os that you want and put the program in it and execute successfully.
well, kind a…
VM’s are not cheap
Although virtual machines seem to solve the os compatibility problem, as you work with them you notice that vms actually execute a fully equipped operating systems just like the one on your machine and as you may guess these operating systems occupy lot’s of unnecessary spaces.
Let me explain that phrase.
Do you really need a fully configured gui(graphical user interface) system in order to run the program (of course gui applications are excluded ) ?
Do you really need the applications those come with os such as a calendar, excel, power-point etc in order to run the program?
The answer is obviously ‘no’ then i should ask that: why bother to install all of them?
Linux container runtime (small isolated computers in a computer)
Before to continue, let's check out the linux container runtime technology.
The technology basically crates small runtime environments in the linux os that are all isolated from each-other.
In the background, a container holds a linux file system from starch with the necessary applications(libraries) and isolates itself from other environments such as the host os as well as the other runtime environments.
long story short this technology is like “small isolated computers in a computer”.
With this technology you can create an isolated linux environment per “application” for example one isolated environment to hold the rest services and one isolated environment for to store the data and furthermore each environment does’t aware of the other, although they are dependent on each other. — this is actually the definition of the separation of the concerns.
And one last thing, containers are cheap when they are compared to the virtual machines.
Prevalent issues in programming world
Due to its nature, programming world always suffers from some common problems and the problems become resolved over time. Here’s some common problems that we need to address.
Compatibility problem
Every peace of application is built on top of some other applications (libraries, operating systems, runtime environments etc) long story short ‘dependencies’
let’s say that you’ve successfully built each dependencies on your machine and your application works perfectly on your computer. What about the production server? we should install all the dependencies to the server exactly we did in our own machine right?
Well, let me ask that; could you always perfectly do that?
(i admire your courage but) the answer is NO!
That’s where ‘but works on my machine’ comes to the surface as an excuse.
Unnecessarily used resources problem
As i’ve just mentioned about, virtual machines resolves the os-depended applications problem yet comes with a ‘catch’, which is; ‘because vms execute fully configured operating systems, they use unnecessary space as we’ve mentioned above’.
When they’re compared to the containers even a single virtual machine exploits our computers resources radically whereas the same computer can run hundreds of containers.
Fast development
Installation of a virtual machine is a time consuming process. After successfully installation you just have an os that’s running. In order to do some developments you must install all the development environment by hand which is also time consuming.
-Wouldn’t be great that if we had a recipe per development environment and a facility that build the environment automatically by considering the recipe?
Conclusion
When we put all the necessaries and existing technologies together, with a little vision and effort we can conclude to the solution below.
- Because of the convenience let’s use linux container runtimes instead of the fully configured operating systems or virtual machines, to run our applications.
- In order to increase the productivity and save more time, let’s create some kind of files that defines what kind of dependencies that we would like to install to this very new container. Let’s put this solution forward by saying that: instead of doing by hand let’s automatize the installation process.
- With the configuration file that contains the dependencies and the code itself that we’d like to run we can create the same runtime environment on the any machine that has linux os on it.
Thus we prevent the “works on my machine” excuse and make sure that if the program runs on our container it works on any other computer perfectly.
All the containerization technologies are built on these ideas.
Docker is the industry standart at the moment.
We call the dependency configuration file as “DockerFile”
Docker automatize the dependency installation process.
Once we create an image(execution ready environment that all the dependencies installed) we can share and run on any other machine perfectly.Containerization technologies comes with another common problem -that issued later on- which is coordinating the containers.
we issued this orchestration problem by devising kubernetes and any other orchestration platform.
Thanks for the reading so far, don’t forget to claps and comment on ❤