What is Docker - GoTechTalk

Tracker

Saturday, September 26, 2020

What is Docker

Docker we bake all of our dependencies into the image directly so it makes it a lot easier to manage all of those dependencies.
By Sudarshan Yerunkar |  | Posted on 26th September 2020 | deals.gotechtalk.com

what is docker




Hey everyone this is Sudarshan, today we are going to dive into docker and containers let's get right into it.

So years ago before containers were a thing we had big companies you name it, they needed to make sure that their business never went down because their business was technology they relied on it, so what they would do is they would is go buy servers and then they would go buy more servers and then that process would rinse and repeat and they basically would over allocate more than they needed and the issue is that with this it was extremely extremely expensive and they needed to do this because as more and more users hit their servers they wanted to make sure that they could scale well and in the process that they wouldn't be able to scale well, then their servers would basically crash and burn and their business would be dead.


Fast-forward a few years 


We have a really cool company it comes out and their name is VMware and VMware says we have this thing to offer it's known as virtualization and what you're going to be able to do is instead of every time you want to run your application you go buy a new server that's really expensive we're gonna allow you to run multiple operating systems on the same host, which essentially means you can run your app in isolation on the same server the same infrastructure but the apps aren't gonna know anything about each other so it's like running an entirely separate computer on the same computer and this was a mind-blowing thing that was a game-changer for the industry, another point, this was a lot more efficient because we could actually take advantage of the resources that we had purchased that were so expensive because we could run more applications in isolation within that bare metal server environment this was really cool because no like I had reiterated we're running multiple apps at once but on the same server and before if you wanted to make sure that you didn't really have a single point of failure for your application you would place them on different servers and then scale horizontally in that fashion.


Unfortunately it's not all roses and daisies because virtualisation is expensive to begin we have multiple kernels for every guest operating system that is going to be running on the infrastructure it's going to have a kernel inside of it and in addition to that for every guest operating system that we add into the infrastructure we have to allocate resources for it although we don't have physical hardware we have virtual hardware so those take up resources we have guest operating system space we have the RAM allocation that we have for this operating system so it's just a lot more expensive although we do get a lot of benefits it's still not the best thing out there.


Fast forward to modern-day containerization


We have a fantastic technology it's known as Docker now docker is really great because for one it's extremely lightweight we don't have the issues of having these crazy to configure virtual machine images that are hard to set up and hard to deploy, docker is they work off images and you can create containers out of these images and it makes it really really lightweight in addition to that it's really portable you have these images that are already really really small basically these bare bone distributions and you can use configuration like docker files to basically spin these things up instantaneously on pretty much any system next it is extremely extremely fast before you'd have to boot up an entire operating system just to get to your application and then you'd have to copy over all of the files which could be a tedious process docker has all of this stuff embedded in its configuration management it starts up within seconds and it's really really quick to use right there in your host machine and one of the biggest benefits that we see from docker that sets it apart from something like a virtual machine is there is no hypervisor and we'll look at that in more detail in a second but essentially what that means is it doesn't have a separate kernel it is still utilizing the same resources as the host OS and it basically exploits namespaces and control groups too tightly use these resources in a more efficient way.


So now let us actually compare and contrast Virtualization versus Containerization.



When we're looking at virtualization from a diagram type view we know that it has infrastructure infrastructure is going to represent what your server is the bare metal the host it could be your laptop your desktop a high-end server what-have-you on top of that we have the operating systemx and the operating system is going to be something like Windows Server could be even your personal laptop like Mac OS or some Linux distribution, in virtualization we have something known as a hypervisor and because we're running these virtual machines which are basically isolated desktop environments inside of a file the hypervisor is what's going to understand how to read that file and this is what a virtual machine images and common hypervisors are things like VMware and VirtualBox and they know how to interpret these operating systems and then on top of that we have the actual guest OS and each one of these guest OS is has their own kernel and this is where things start to get a little bit expensive from a resource allocation perspective and then on top of the OS is where we would actually install our binaries and our libraries and then finally we could copy over all of our files on to this operating system that actually makes up our application that we want to deploy on the server.


Now let's contrast this to containerization containerization has infrastructure of course things like what we had just mentioned and in addition to that it has the operating system but what's different is it doesn't actually have a hypervisor it has a process that runs directly on the operating system known as the Docker Damon and the docker daemon is what facilitates and manages things like the running containers on the system the images that you create and all of the command line utilities that come with docker the applications that we run within these images basically run directly on the exact host machine and what happens is we create images which are like copies of the application that we want to distribute and a running instance of an image is what's known as a container and each container has one process in a typically our application, what it does is it actually segments utilizing things like namespacing and control groups to piggyback off the resources directly on the host machine, so we're using the same kernel but we're using namespaces to say hey this is the segment of the system that you can have and control groups will say this is how much of that thing that you can have this is how much RAM you can have this is how much network bandwidth you are allocated and that is how docker exploits the operating system that it runs on without needing a hypervisor, so it's really beneficial because we are on the same host we can more tightly couple ourselves to the resources of the operating system and the system that we're running on and on top of all of that it's just a lot faster and it's a lot more portable so that's why a lot of people are preferring docker over the traditional virtual machine.


I want to touch on just a few more points and the main one is we fix the problem using docker when people say it works on my computer but not Theirs, this problem goes away and this is because we packaged a working running instance of our application inside of an image and then that's the thing that gets deployed, so there's never any of this hey it works on my machine but it doesn't work on their machine docker resolves that issue in addition to this we have better dependency management typically you have your dependencies scattered all across your application and then deploying it on another server is a very time-consuming tedious process, but within docker we bake all of our dependencies into the image directly so it makes it a lot easier to manage all of those dependencies and then of course the main thing that we've reiterated in multiple times is it is a lot more lightweight than something like a typical virtual machine and that's a huge benefit.

If this helped you learn something new please let me know into the comments and share this to your friends.

No comments:

Post a Comment

close