WEBVTT

00:05.370 --> 00:06.920
Everyone welcome back.

00:07.290 --> 00:14.970
So in this section we're going to be introducing docker and I've heard this name it sort of became famous

00:14.970 --> 00:18.390
in the past few years during development.

00:18.600 --> 00:20.240
And so we will be using docker.

00:20.230 --> 00:24.310
But before we explain what doctor is or why we're going to be using it.

00:24.630 --> 00:31.560
I want to sort of tell you why Dockery's is really you know hyped around these days and why it's talked

00:31.560 --> 00:36.250
about a lot and why it's really important what what it's supposed to do.

00:36.680 --> 00:37.010
OK.

00:37.050 --> 00:45.630
So in the old ages you used to have you know we had a big problem and that problem was called it works

00:45.630 --> 00:50.790
on my machine but it doesn't work on the production machine or doesn't work on his machine.

00:51.070 --> 00:52.590
Now what does that really mean.

00:52.770 --> 00:56.840
Well what happened was the developers had their own machines right.

00:56.840 --> 01:05.730
Some of this is machine of developer one guy and then the developer would have his code and everything

01:05.730 --> 01:07.040
be fine here.

01:07.260 --> 01:12.570
He would have his environment here and his I.D. and everything was perfect and he would run the code

01:12.680 --> 01:13.970
was perfect.

01:14.130 --> 01:20.070
Then he would upload it to some you know they didn't have it back in the days but we had something like

01:20.100 --> 01:23.900
A.P.M. to applaud his code to SVM.

01:24.210 --> 01:25.770
And then another developer.

01:25.800 --> 01:29.400
So this is machine to for developer 2.

01:29.880 --> 01:37.380
So that developer would you know code that code from as VM and then he has his own environment and his

01:37.380 --> 01:39.260
own ID.

01:39.270 --> 01:45.720
Now what happens is once this guy pulls the code from here and here runs it and then he gets a bunch

01:45.720 --> 01:49.140
of you know 100 errors telling him everything is going wrong.

01:49.150 --> 01:51.450
You know this code is wrong syntax error.

01:51.570 --> 01:55.390
You're missing this library and all this problematic stuff.

01:55.530 --> 01:57.840
And this problem used to happen a lot.

01:57.840 --> 02:04.410
And the reason is because the environment you can't guarantee that both of these environments and by

02:04.410 --> 02:10.440
environment I mean all the libraries on the system you know the operating system everything on that

02:10.440 --> 02:14.400
machine you can't guarantee that these two environments are exactly the same.

02:14.400 --> 02:14.760
Right.

02:14.760 --> 02:21.060
This guy might be using Windows this guy might be using a Mac or Linux so that we used to have this

02:21.150 --> 02:28.500
lots of problems of uploading the code in code calling get from the from the get help or SVM or whatever

02:28.800 --> 02:31.150
and then we would have this problem.

02:31.170 --> 02:37.340
So the first solution that we can and this problem wasn't only on you know in development.

02:37.380 --> 02:42.720
Imagine what would happen when you finally finished the whole project and you want to push it for example

02:43.110 --> 02:44.090
on our server.

02:44.100 --> 02:47.350
So this is your server on the Internet.

02:47.580 --> 02:49.460
So this is on the worldwide Internet.

02:49.680 --> 02:56.190
So you would again you would buy a server you would go into the server and then you would pull your

02:56.190 --> 02:57.910
code from that thing.

02:58.020 --> 03:03.460
But then once you have your code here this server has a totally different environment from yours.

03:03.570 --> 03:03.830
Right.

03:03.840 --> 03:07.010
And you can install also a different ID.

03:07.170 --> 03:11.100
But the problem is once you run the code on the server then you have a ton of arrows.

03:11.120 --> 03:16.980
And that means all your work is for nothing you have to fix all these areas here your code isn't done

03:16.980 --> 03:17.450
yet.

03:17.760 --> 03:19.410
So this used to be a huge problem right.

03:19.420 --> 03:25.250
You would have people working for ages on a machine or on their code on their local server.

03:25.260 --> 03:30.420
And then once they put it on the actual server you know the online server that everything would crash

03:30.420 --> 03:31.010
and burn.

03:31.020 --> 03:31.260
Right.

03:31.260 --> 03:32.080
This is bad.

03:32.100 --> 03:33.130
We don't want that.

03:33.450 --> 03:39.360
We want to ensure that if the code works on my machine then it it has to work on the server.

03:39.660 --> 03:40.890
So the first solution.

03:40.900 --> 03:41.120
Right.

03:41.130 --> 03:47.120
This was first no solution that came to the mind of people always was virtualization.

03:47.130 --> 03:49.110
So why is virtualization.

03:49.320 --> 03:54.330
So essentially what they were doing is you have your machine here right.

03:54.590 --> 03:55.470
OK.

03:55.480 --> 03:57.390
So this is your machine.

03:57.820 --> 04:01.770
And then on your machine you have an operating system right.

04:03.320 --> 04:11.420
So on top of that operating system where you have your code here you have your code here environment.

04:11.810 --> 04:14.110
And you know your idea here.

04:14.120 --> 04:14.750
OK.

04:15.090 --> 04:21.150
So what would happen is they would use something like a virtual box.

04:21.300 --> 04:21.630
Right.

04:21.630 --> 04:28.500
The one we're using to make up a virtual machine so that virtual machine is another.

04:28.500 --> 04:29.090
Right.

04:29.230 --> 04:40.200
The Virtual Machine 1 and then that virtual machine has an OS and then on that OS they copy their code

04:41.140 --> 04:47.920
and they put it front from their own machine onto the virtual machine so they put their code here but

04:47.920 --> 04:50.250
they don't include their environment.

04:50.750 --> 04:55.330
They don't include the environment and they can install the each.

04:55.930 --> 05:01.110
Now this virtual machine over here right is virtual machine over here.

05:01.420 --> 05:08.170
Before they started doing anything they knew that their server right for example would be running on

05:08.250 --> 05:09.090
buntu.

05:09.400 --> 05:09.930
Whoops.

05:09.970 --> 05:12.860
Buntu for example sixteen point four.

05:13.030 --> 05:18.110
They knew that their server would have apache or whatever.

05:18.250 --> 05:22.140
They knew the environment of the server they were going to put their code.

05:22.420 --> 05:29.770
So what they did was they made sure that this virtual machine is an exact replica of this server so

05:29.770 --> 05:37.450
that if the code works on this virtual machine which is running on your machine then it it must your

05:37.450 --> 05:39.240
code must work on the server.

05:39.280 --> 05:46.180
Once you put this code onto SVM right once you put your code up there and pull it to the server it must

05:46.180 --> 05:49.290
work because it's running on the same virtual machine here.

05:50.420 --> 05:53.410
Now this works perfectly fine right.

05:53.420 --> 05:55.290
In fact that's what we're doing here.

05:55.430 --> 06:02.570
So for I'm running my windows and then I have a you know an event to machine and then I'm running my

06:02.570 --> 06:07.780
code inside that machine that's perfectly fine and there's no problem with that.

06:08.150 --> 06:14.230
But there is a problem if you see here that this is very intensive.

06:14.250 --> 06:14.470
Right.

06:14.480 --> 06:21.880
This is a very resource heavy where basically have a whole running machine on our machine.

06:21.870 --> 06:26.570
This is the Lotzen abstractions and this ends up making the whole process slow.

06:26.570 --> 06:33.320
In fact if you look at my virtual machine it's quite slow because there's you know there's so many layers

06:33.320 --> 06:36.340
between your code running in between the actual hardware.

06:36.340 --> 06:39.150
Right because your code is here.

06:39.430 --> 06:45.440
Well it has to be translated by the OS and then through the virtual machine and then virtual box changes

06:45.500 --> 06:51.980
these commands into something that your OS understands and then your OS finally executes these command

06:52.000 --> 06:54.380
by your actual hardware machine.

06:54.380 --> 07:01.040
This is a horrible thing to go for because you're you're going through so many levels of abstractions

07:01.340 --> 07:03.310
that it slows the whole process.

07:03.860 --> 07:11.630
So what is the solution to this well let's get this remove this and the solution is is actually Dharker

07:12.350 --> 07:13.560
so Dunkerque.

07:13.670 --> 07:18.650
And that creates a new idea it's actually a very old idea.

07:18.680 --> 07:22.010
But it recently gained a lot of publicity.

07:22.040 --> 07:26.880
Used to be called in a Linux container back in the day.

07:26.900 --> 07:30.230
But you know now it's very very famous.

07:30.450 --> 07:31.440
Oh the name Doctor.

07:31.460 --> 07:32.450
But anyways.

07:32.600 --> 07:34.590
So what's the idea behind ogar.

07:34.820 --> 07:36.120
Well Tucker is.

07:36.230 --> 07:38.700
Well let's again draw the stack.

07:38.810 --> 07:43.100
This is your machine right your actual hardware.

07:43.760 --> 07:46.800
Now your machine is running an OS.

07:46.910 --> 07:49.320
So your OS is here.

07:49.880 --> 07:55.170
Well what one doctor does is Doc is made of a darker engine.

07:55.400 --> 08:04.180
So there a darker engine let your your car engine layer that sits on your operating system.

08:04.190 --> 08:07.690
Now this darker engine can host on it.

08:07.730 --> 08:15.420
Multiple applications so it can host application one application too.

08:16.180 --> 08:23.510
And so so all of these applications are running and they think eight each.

08:23.560 --> 08:31.000
Each of them has code and environment and different environment you can have here one application running

08:31.000 --> 08:32.940
with a Windows and here and one application.

08:32.980 --> 08:35.570
Linux totally different environments.

08:35.750 --> 08:41.870
So so was a code one environment one code 2 environment 2 and so on.

08:42.070 --> 08:47.070
So each of these are running different different environments different code.

08:47.200 --> 08:54.340
And what happens is it takes the environment let's say you run a code on this environment it takes this

08:55.180 --> 09:02.580
the darker engine takes this from application one and then translates it into something automatically

09:02.880 --> 09:04.370
to your operating system.

09:04.380 --> 09:06.600
And this is where the magic really happens.

09:06.690 --> 09:11.200
And we weren't going to wups this should be an engine.

09:11.240 --> 09:13.000
Again sorry for the typo.

09:13.050 --> 09:18.310
So this is where the magic happened the docker engine is what does all what makes all this possible.

09:18.480 --> 09:25.050
It takes your environment and your code and everything there and translates it using you know let's

09:25.050 --> 09:31.620
say just some magic we won't go into too much details and it translates into something your operating

09:31.620 --> 09:37.570
system understands which in turn goes to your machine and your machine performs its operation.

09:37.770 --> 09:44.370
Now you can see that this is much much better than you know stacking in two layers of operating systems

09:44.370 --> 09:47.940
and machines you just having your machine your operating system.

09:47.940 --> 09:52.470
This abstraction level here which is knocker engine and then your application.

09:52.530 --> 09:55.910
So this is much much much better now.

09:56.100 --> 09:59.410
We have some terminology here.

09:59.410 --> 10:08.830
We know that usually this running application is called a container instead of an app because really

10:08.830 --> 10:10.910
it could be running an application.

10:11.050 --> 10:16.390
You can be running one of them just as a date database and you can just run a my Seacole database.

10:16.400 --> 10:17.260
It's fine.

10:17.330 --> 10:22.300
It doesn't have to be an app so a container is a more generally now.

10:22.450 --> 10:26.330
A container is made out of an image.

10:26.390 --> 10:28.310
So what is an image image is basically.

10:28.310 --> 10:30.740
Think of that as a as a text file.

10:30.740 --> 10:37.720
This text file describes all the properties of the environment that this application should run.

10:37.910 --> 10:43.450
So for example I can say you know this machine should run in venta.

10:43.580 --> 10:44.380
Right.

10:44.900 --> 10:46.430
Sixteen point four.

10:46.580 --> 10:49.520
It should have Python 3.

10:49.610 --> 10:53.450
It should install blah blah blah.

10:53.750 --> 11:00.080
So you're basically explaining the entire environment of this application.

11:00.420 --> 11:07.320
And then once you have this then you run your image and you generate a container which is your actual

11:07.320 --> 11:08.450
working code.

11:10.240 --> 11:13.480
So that's basically it for the beginning.

11:13.810 --> 11:19.720
And just just a final thing usually Let's say you know you have your cert.

11:19.810 --> 11:20.200
Right.

11:20.290 --> 11:25.840
OK so this is your server and you know your server is running on for example.

11:26.830 --> 11:34.940
So you can in other words you can now say OK I'll make my server have open to sixteen point for my server

11:34.950 --> 11:35.850
it doesn't have bytes.

11:35.860 --> 11:40.030
And so I'm going to make my image to install Python 3.

11:40.030 --> 11:42.580
Because a normal server a normal one too.

11:42.640 --> 11:48.270
Maybe doesn't come with twice in three maybe maybe it comes from let's say you also need another piece.

11:48.280 --> 11:54.090
I'm going to also make my system my environment have non-P which is a python library.

11:54.550 --> 11:56.280
And then I'm going to install this.

11:56.290 --> 11:59.400
I'm going to tap this or whatever.

11:59.410 --> 12:03.730
So you're basically explaining how your environment should look like.

12:03.820 --> 12:09.920
Now if your code works here what you would do is you would go to your server.

12:10.090 --> 12:14.050
Once you finally want to run.

12:14.500 --> 12:19.560
So this is the server machine.

12:19.890 --> 12:25.210
So once you finally want to deploy your project once you want to put your project on the Internet you

12:25.210 --> 12:28.140
basically go into your server.

12:28.210 --> 12:35.960
The first thing is you install docker C so that you have that darker engine here.

12:36.430 --> 12:44.740
And then finally you simply pull this image only this simple image into your server.

12:44.860 --> 12:51.430
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.

12:51.520 --> 12:52.090
Right.

12:52.180 --> 12:56.870
Just make it come to or and run this image and that's it.

12:56.920 --> 13:00.080
Once you run this image then it will be perfect.

13:00.140 --> 13:05.900
Bachar guarantees you that it must work on this server.

13:05.980 --> 13:07.770
So there's no more problems off.

13:07.780 --> 13:14.350
You know what it worked on my machine that it's not working on the server or you know even if two programmers

13:14.350 --> 13:17.820
are doing it they can't say oh it's working on my machine but not his machine.

13:17.860 --> 13:21.570
Linux machine but not my Windows machine or whatever.

13:21.580 --> 13:29.010
So basically Gawker is a way to to get rid of this annoying problem which you know it might sound you

13:29.010 --> 13:36.080
know funny but in fact many projects were ruined because of that because you know you can develop it

13:36.070 --> 13:36.720
locally.

13:36.730 --> 13:38.230
All your all your project.

13:38.230 --> 13:42.530
And then finally when you want to put it on the server and it's not working anymore.

13:42.730 --> 13:48.790
So you have to you know do everything again from scratch which is you know very bad general I don't

13:48.790 --> 13:50.000
want to do that.

13:50.490 --> 13:55.030
So yeah that's that's basically the idea of darker you're basically you know.

13:55.030 --> 13:57.400
To quickly recap your build.

13:57.400 --> 14:03.000
You're putting a dog cart engine on your operating system and then you're describing using an image.

14:03.010 --> 14:05.530
What that environed for each application.

14:05.530 --> 14:07.090
So this is image what.

14:07.090 --> 14:13.270
So this is for application one for each of these applications are for each of these databases you explain

14:13.270 --> 14:16.740
exactly what you want how you want to describe them.

14:16.750 --> 14:23.020
So for example I want to say oh this container should have buntu on it should have Python 3.

14:23.050 --> 14:26.070
And now page and install this blah blah blah.

14:26.200 --> 14:30.580
Astrid for example run an app IPY.

14:30.640 --> 14:39.370
Once it once it runs once this application starts it should run up right after it does all these operations.

14:39.370 --> 14:44.400
So we're basically explain how all this should should should be explained.

14:44.440 --> 14:50.860
And then once we're done with that then we can use this image to generate a container and run it from

14:50.860 --> 14:56.110
this image to a container which would be our working application.

14:56.110 --> 15:03.490
Now once we're happy with our code and by the way your image also has your code in it.

15:03.720 --> 15:06.090
So your code is on the side here.

15:06.120 --> 15:11.730
So once you have your code then you can find that once you're happy about your image then you can finally

15:12.040 --> 15:20.250
put your put your image on get halber SVM or or any or any other program and that pull it from as V.M.

15:20.730 --> 15:29.580
into your server and then install Locher on your server and then run this around this image to generate

15:29.580 --> 15:30.650
the container.

15:30.960 --> 15:37.530
So now you have ABC1 here and now once you have this container here that's it that's all you have to

15:37.530 --> 15:39.910
do your application is working.

15:39.990 --> 15:47.430
And if you have any requests from anywhere in the Internet it's going to be handled by this application.

15:48.340 --> 15:53.650
So yeah in the next video we got we're going to be talking more about Takhar so until the next video

15:53.830 --> 15:54.590
has become an.
