uppose, You created an application, and its running very well on your machine, But you need to deploy this into
other machines… What will come into your mind?
Of course, You need to install all the dependencies, software and tools into other machines for this app.
Let’s suppose again.. What if you have created two applications and want to deploy on another machine ( Both app in the same machine ). What will you do?
Here Docker will help you…..
"Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Docker is the best deployment technique this time and it is very effective while deployment. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. By doing so, thanks to the container, the developer can rest assured that the application will run on any other Linux machine regardless of any customized settings that machine might have that could differ from the machine used for writing and testing the code."
# Let’s pick a real technical example:
Imagine we have a computer, suppose there are 3 applications App1, App2, and App3 and computer have only one set of libraries & Framework like this:
Imagine our all 3 applications needs Ruby on Rails frameworks and our system has installed this. Now our all 3
applications working fine. But what happen if our all 3 applications need different version of Ruby on Rails.
App1 need Ruby On Rails version 1
App2 need Ruby On Rails version 2
App3 need Ruby On Rails version 3
As in picture:
And our system has installed Ruby on Rails version 3.
Then can you guess what would happen? Our App1 and App2 would stop working and only App3 will work.
How do we fix this ? How do we get all three application would work?
We have two solutions..
Solution 1:Different computer for a different app with the appropriate version.
It means :App1 would have Ruby On Rails version 1.
App2 would have Ruby On Rails version 2.
App3 would have Ruby On Rails version 3.
Now our all app will work properly.
But that would be very expensive, That is what virtual machines ( VMs ) do.
The virtual machine replicates over and over and over again.
Is there a better way?......... Yes there is: Docker
To get rid of this problem you can use “Docker”. You can wrap your application within the docker. And every app will run under a container. For your understanding, A container is a software environment that contains one or more process.
In the above image, every app is running under the separate containers, and every version of Ruby on rails is running on a different image, all are running under the same OS.
Using docker, If you want to run App1 into other systems, Just copy App1 and paste it to the location. and run using the docker. The app will work fine in another system.
Basic terms of Docker:
An image is a portable program of a set of files that can be reused and served. They are divided into layered and layers can be reused. It is used to execute code in a docker container. An image contains a set of instructions to execute an application. When docker starts, images get executed and become one or multiple containers.
A container is a run time environment on the image. Container holds the application and is responsible to run an application. Now you have a basic idea about the docker. I will soon write an article on “How to dockerize an app”.
In this article, we learned "what is docker? and its image and container."