Everyone welcome back.
So in this section we're going to be introducing docker and I've heard this name it sort of became famous
in the past few years during development.
And so we will be using docker.
But before we explain what doctor is or why we're going to be using it.
I want to sort of tell you why Dockery's is really you know hyped around these days and why it's talked
about a lot and why it's really important what what it's supposed to do.
OK.
So in the old ages you used to have you know we had a big problem and that problem was called it works
on my machine but it doesn't work on the production machine or doesn't work on his machine.
Now what does that really mean.
Well what happened was the developers had their own machines right.
Some of this is machine of developer one guy and then the developer would have his code and everything
be fine here.
He would have his environment here and his I.D. and everything was perfect and he would run the code
was perfect.
Then he would upload it to some you know they didn't have it back in the days but we had something like
A.P.M. to applaud his code to SVM.
And then another developer.
So this is machine to for developer 2.
So that developer would you know code that code from as VM and then he has his own environment and his
own ID.
Now what happens is once this guy pulls the code from here and here runs it and then he gets a bunch
of you know 100 errors telling him everything is going wrong.
You know this code is wrong syntax error.
You're missing this library and all this problematic stuff.
And this problem used to happen a lot.
And the reason is because the environment you can't guarantee that both of these environments and by
environment I mean all the libraries on the system you know the operating system everything on that
machine you can't guarantee that these two environments are exactly the same.
Right.
This guy might be using Windows this guy might be using a Mac or Linux so that we used to have this
lots of problems of uploading the code in code calling get from the from the get help or SVM or whatever
and then we would have this problem.
So the first solution that we can and this problem wasn't only on you know in development.
Imagine what would happen when you finally finished the whole project and you want to push it for example
on our server.
So this is your server on the Internet.
So this is on the worldwide Internet.
So you would again you would buy a server you would go into the server and then you would pull your
code from that thing.
But then once you have your code here this server has a totally different environment from yours.
Right.
And you can install also a different ID.
But the problem is once you run the code on the server then you have a ton of arrows.
And that means all your work is for nothing you have to fix all these areas here your code isn't done
yet.
So this used to be a huge problem right.
You would have people working for ages on a machine or on their code on their local server.
And then once they put it on the actual server you know the online server that everything would crash
and burn.
Right.
This is bad.
We don't want that.
We want to ensure that if the code works on my machine then it it has to work on the server.
So the first solution.
Right.
This was first no solution that came to the mind of people always was virtualization.
So why is virtualization.
So essentially what they were doing is you have your machine here right.
OK.
So this is your machine.
And then on your machine you have an operating system right.
So on top of that operating system where you have your code here you have your code here environment.
And you know your idea here.
OK.
So what would happen is they would use something like a virtual box.
Right.
The one we're using to make up a virtual machine so that virtual machine is another.
Right.
The Virtual Machine 1 and then that virtual machine has an OS and then on that OS they copy their code
and they put it front from their own machine onto the virtual machine so they put their code here but
they don't include their environment.
They don't include the environment and they can install the each.
Now this virtual machine over here right is virtual machine over here.
Before they started doing anything they knew that their server right for example would be running on
buntu.
Whoops.
Buntu for example sixteen point four.
They knew that their server would have apache or whatever.
They knew the environment of the server they were going to put their code.
So what they did was they made sure that this virtual machine is an exact replica of this server so
that if the code works on this virtual machine which is running on your machine then it it must your
code must work on the server.
Once you put this code onto SVM right once you put your code up there and pull it to the server it must
work because it's running on the same virtual machine here.
Now this works perfectly fine right.
In fact that's what we're doing here.
So for I'm running my windows and then I have a you know an event to machine and then I'm running my
code inside that machine that's perfectly fine and there's no problem with that.
But there is a problem if you see here that this is very intensive.
Right.
This is a very resource heavy where basically have a whole running machine on our machine.
This is the Lotzen abstractions and this ends up making the whole process slow.
In fact if you look at my virtual machine it's quite slow because there's you know there's so many layers
between your code running in between the actual hardware.
Right because your code is here.
Well it has to be translated by the OS and then through the virtual machine and then virtual box changes
these commands into something that your OS understands and then your OS finally executes these command
by your actual hardware machine.
This is a horrible thing to go for because you're you're going through so many levels of abstractions
that it slows the whole process.
So what is the solution to this well let's get this remove this and the solution is is actually Dharker
so Dunkerque.
And that creates a new idea it's actually a very old idea.
But it recently gained a lot of publicity.
Used to be called in a Linux container back in the day.
But you know now it's very very famous.
Oh the name Doctor.
But anyways.
So what's the idea behind ogar.
Well Tucker is.
Well let's again draw the stack.
This is your machine right your actual hardware.
Now your machine is running an OS.
So your OS is here.
Well what one doctor does is Doc is made of a darker engine.
So there a darker engine let your your car engine layer that sits on your operating system.
Now this darker engine can host on it.
Multiple applications so it can host application one application too.
And so so all of these applications are running and they think eight each.
Each of them has code and environment and different environment you can have here one application running
with a Windows and here and one application.
Linux totally different environments.
So so was a code one environment one code 2 environment 2 and so on.
So each of these are running different different environments different code.
And what happens is it takes the environment let's say you run a code on this environment it takes this
the darker engine takes this from application one and then translates it into something automatically
to your operating system.
And this is where the magic really happens.
And we weren't going to wups this should be an engine.
Again sorry for the typo.
So this is where the magic happened the docker engine is what does all what makes all this possible.
It takes your environment and your code and everything there and translates it using you know let's
say just some magic we won't go into too much details and it translates into something your operating
system understands which in turn goes to your machine and your machine performs its operation.
Now you can see that this is much much better than you know stacking in two layers of operating systems
and machines you just having your machine your operating system.
This abstraction level here which is knocker engine and then your application.
So this is much much much better now.
We have some terminology here.
We know that usually this running application is called a container instead of an app because really
it could be running an application.
You can be running one of them just as a date database and you can just run a my Seacole database.
It's fine.
It doesn't have to be an app so a container is a more generally now.
A container is made out of an image.
So what is an image image is basically.
Think of that as a as a text file.
This text file describes all the properties of the environment that this application should run.
So for example I can say you know this machine should run in venta.
Right.
Sixteen point four.
It should have Python 3.
It should install blah blah blah.
So you're basically explaining the entire environment of this application.
And then once you have this then you run your image and you generate a container which is your actual
working code.
So that's basically it for the beginning.
And just just a final thing usually Let's say you know you have your cert.
Right.
OK so this is your server and you know your server is running on for example.
So you can in other words you can now say OK I'll make my server have open to sixteen point for my server
it doesn't have bytes.
And so I'm going to make my image to install Python 3.
Because a normal server a normal one too.
Maybe doesn't come with twice in three maybe maybe it comes from let's say you also need another piece.
I'm going to also make my system my environment have non-P which is a python library.
And then I'm going to install this.
I'm going to tap this or whatever.
So you're basically explaining how your environment should look like.
Now if your code works here what you would do is you would go to your server.
Once you finally want to run.
So this is the server machine.
So once you finally want to deploy your project once you want to put your project on the Internet you
basically go into your server.
The first thing is you install docker C so that you have that darker engine here.
And then finally you simply pull this image only this simple image into your server.
So maybe by pulling in maybe app I mean put it on as VM write or get help and then pull it to your server.
Right.
Just make it come to or and run this image and that's it.
Once you run this image then it will be perfect.
Bachar guarantees you that it must work on this server.
So there's no more problems off.
You know what it worked on my machine that it's not working on the server or you know even if two programmers
are doing it they can't say oh it's working on my machine but not his machine.
Linux machine but not my Windows machine or whatever.
So basically Gawker is a way to to get rid of this annoying problem which you know it might sound you
know funny but in fact many projects were ruined because of that because you know you can develop it
locally.
All your all your project.
And then finally when you want to put it on the server and it's not working anymore.
So you have to you know do everything again from scratch which is you know very bad general I don't
want to do that.
So yeah that's that's basically the idea of darker you're basically you know.
To quickly recap your build.
You're putting a dog cart engine on your operating system and then you're describing using an image.
What that environed for each application.
So this is image what.
So this is for application one for each of these applications are for each of these databases you explain
exactly what you want how you want to describe them.
So for example I want to say oh this container should have buntu on it should have Python 3.
And now page and install this blah blah blah.
Astrid for example run an app IPY.
Once it once it runs once this application starts it should run up right after it does all these operations.
So we're basically explain how all this should should should be explained.
And then once we're done with that then we can use this image to generate a container and run it from
this image to a container which would be our working application.
Now once we're happy with our code and by the way your image also has your code in it.
So your code is on the side here.
So once you have your code then you can find that once you're happy about your image then you can finally
put your put your image on get halber SVM or or any or any other program and that pull it from as V.M.
into your server and then install Locher on your server and then run this around this image to generate
the container.
So now you have ABC1 here and now once you have this container here that's it that's all you have to
do your application is working.
And if you have any requests from anywhere in the Internet it's going to be handled by this application.
So yeah in the next video we got we're going to be talking more about Takhar so until the next video
has become an.