What is docker?
S
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."
— opensource.com
# 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:
Source: idkblogs.com
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.
Suppose :
App1 need Ruby On Rails version 1
App2 need Ruby On Rails version 2
App3 need Ruby On Rails version 3
As in picture:
Source: idkblogs.com
And our system has installed Ruby on Rails version 3.
Source: idkblogs.com
Then can you guess what would happen? Our App1 and App2 would stop working and only App3 will work.
Source: idkblogs.com
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.Source: idkblogs.com
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.
Source: idkblogs.com
Now our all app will work properly.
Source: idkblogs.com
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
Source: idkblogs.com
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.
Source: idkblogs.com
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.
Source: idkblogs.com
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:
Image:
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.
Container:
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”.
Conclusion:
In this article, we learned "what is docker? and its image and container."
Support our IDKBlogs team
Creating quality content takes time and resources, and we are committed to providing value to our
readers.
If you find my articles helpful or informative, please consider supporting us financially.
Any amount (10, 20, 50, 100, ....), no matter how small, will help us continue to produce
high-quality content.
Thank you for your support!
Thank you
I appreciate you taking the time to read this article. The more that you read, the more things you will know. The more that you learn, the more places you'll go.
If you’re interested in Node.js or JavaScript this link will help you a lot.
If you found this article is helpful, then please share this article's link to your friends to whom this is required, you can share this to your technical social media groups also.
You can follow us on our social media page for more updates and latest article updates.
To read more about the technologies, Please
subscribe us, You'll get the monthly newsletter having all the published
article of the last month.