1
00:00:04,760 --> 00:00:11,750
No doctor is available for use, and now it's time to create the custom Docker image from our API folder

2
00:00:12,290 --> 00:00:17,420
and then that Docker image, we will put the all files located in this folder.

3
00:00:17,900 --> 00:00:25,520
And afterwards, we will create container based on this newly created image and we will run such container.

4
00:00:26,180 --> 00:00:32,689
And in order to create new image using Docker, you need to create a file with instructions for Docker,

5
00:00:33,020 --> 00:00:35,660
and this file is called Docker file.

6
00:00:36,290 --> 00:00:39,860
Let's start with that and list in the root of the API a folder.

7
00:00:39,950 --> 00:00:42,830
Create new file gold docker file.

8
00:00:43,070 --> 00:00:46,250
Starting from the capital deep docker file.

9
00:00:46,640 --> 00:00:50,510
And notice that we as gold will automatically recognize type of this file.

10
00:00:50,690 --> 00:00:52,820
And here with this Docker item.

11
00:00:53,250 --> 00:00:59,480
So let's create such file and immediately you'll see suggestion from the school to install recommended

12
00:00:59,480 --> 00:01:02,990
extensions for Docker, and let's go ahead and install them.

13
00:01:03,680 --> 00:01:10,670
Extension is gold Docker and using such extension that you're able to very easily build new images and

14
00:01:10,670 --> 00:01:11,960
Darren Docker containers.

15
00:01:12,110 --> 00:01:17,120
Also, there was Docker Explorer many, many different features available directly in the code.

16
00:01:17,510 --> 00:01:24,020
Let me close this step and let me close this step as well, and let's keep only Docker file open here.

17
00:01:24,620 --> 00:01:29,750
So now let's write some instructions for Docker in this Docker a file.

18
00:01:30,380 --> 00:01:33,620
The instruction will be from and using such instruction.

19
00:01:33,650 --> 00:01:41,090
You could tell Docker which based image it should use for your custom image, and we will use by adding

20
00:01:41,090 --> 00:01:41,870
based image.

21
00:01:42,590 --> 00:01:46,010
There are, of course, multiple decks for this base image.

22
00:01:46,400 --> 00:01:50,720
And let's quickly go to Docker hub and verify which tracks are available for use.

23
00:01:51,200 --> 00:01:56,180
Let's open up a Google Chrome and here in the new tab, let's open Docker Hub.

24
00:01:57,610 --> 00:02:01,570
And click on the second link that leads you to have the doctor com.

25
00:02:02,740 --> 00:02:05,980
And he search for by them like that.

26
00:02:06,580 --> 00:02:09,030
And click here on this ghost by Adam Link.

27
00:02:09,580 --> 00:02:12,220
It will lead you to buy it on an image page.

28
00:02:12,400 --> 00:02:14,170
It is official Docker image.

29
00:02:14,710 --> 00:02:19,660
And in the description, you might find which tags are available for use.

30
00:02:20,290 --> 00:02:26,950
Here was a long, long list of the attacks and I'll use abortion data scrolled 3.9.

31
00:02:27,250 --> 00:02:29,640
If I search for it, I'll find it here.

32
00:02:30,220 --> 00:02:32,310
And it is basically tech for Brazil.

33
00:02:32,320 --> 00:02:38,980
Three Dot 9.4 Because as you might see, there are several things that point to the same image.

34
00:02:39,190 --> 00:02:47,170
For instance, text 3.9 Dot from 3.9 three and latest point to the version 3.9 9.4 four.

35
00:02:47,560 --> 00:02:51,850
Because at the moment of this recording, the latest version is 3.2 9.4.

36
00:02:52,540 --> 00:02:57,970
There are, of course, release candidate versions for the next version of the title, but I'll utilize

37
00:02:57,970 --> 00:03:04,000
this latest one and I'll specify this exact text 3.9 this way.

38
00:03:04,060 --> 00:03:09,220
Let's go back to doggerel file here and type text 3.9 like that?

39
00:03:09,880 --> 00:03:11,980
First instruction for base image?

40
00:03:12,670 --> 00:03:15,210
Next instruction will work deal.

41
00:03:15,520 --> 00:03:21,670
Notice that the Ice-Cold suggests, you know, to use different instructions in this Dogra file.

42
00:03:21,970 --> 00:03:24,640
That's because we installed Docker extension.

43
00:03:25,390 --> 00:03:27,850
Let's select this option from dropdown list.

44
00:03:28,180 --> 00:03:33,220
And here you need to specify path to the working directory inside of the image.

45
00:03:33,670 --> 00:03:40,730
And then that working directory Docker will actually store all your application files where there was

46
00:03:40,730 --> 00:03:47,350
a folder called API, and there are such files as amended by B.A.P File and all those inside.

47
00:03:48,260 --> 00:03:54,410
And those files that are located in the FBI folder, we want to throw in their working directory inside

48
00:03:54,410 --> 00:03:55,370
of the image.

49
00:03:56,270 --> 00:03:58,070
This way here let's be sapphire.

50
00:03:58,070 --> 00:04:01,660
For instance, Bath gold flares up like that.

51
00:04:02,030 --> 00:04:03,470
The stands for application.

52
00:04:04,320 --> 00:04:10,520
Notice that it is actually possible to place all application files in the root of the file system of

53
00:04:10,520 --> 00:04:13,970
corresponding image, but it's not the recommended practice.

54
00:04:14,300 --> 00:04:20,390
You should always create a separate folder like this one and place all application of files inside of

55
00:04:20,390 --> 00:04:20,660
it.

56
00:04:21,200 --> 00:04:23,990
And when will create a container based on this image?

57
00:04:24,110 --> 00:04:29,340
I'll demonstrate to you how file system inside of the container looks like the moment.

58
00:04:29,360 --> 00:04:34,970
Let's keep this instruction like this working directory points less up.

59
00:04:35,420 --> 00:04:42,440
Notice also that Docker will automatically create such folder if it is absent using Make Directory Command.

60
00:04:42,800 --> 00:04:46,910
You don't need to specify a separate command for creation of such folder.

61
00:04:47,690 --> 00:04:53,470
Next instruction that we will add here in the file is called Expose Lists Type Expose and you'll see

62
00:04:53,480 --> 00:04:55,130
suggestion expose fraud.

63
00:04:55,250 --> 00:04:56,360
Let's select it.

64
00:04:56,900 --> 00:05:03,770
And here, instead of brought, you need to type port number that you want to expose from such image.

65
00:05:04,430 --> 00:05:08,660
And that's that broad that is used for launch of our application.

66
00:05:09,180 --> 00:05:12,290
Let's open up explorer and go to a file.

67
00:05:12,440 --> 00:05:17,960
And here on this line, we start Python Flask, a web server at Broad 50 50.

68
00:05:18,350 --> 00:05:21,740
And that's that broad that we should expose in Docker.

69
00:05:22,220 --> 00:05:28,010
So let's go to Docker file and here type expose 50 50 like that.

70
00:05:28,970 --> 00:05:35,900
Next will be instructions related to installation of the Python dependencies inside of the Docker image,

71
00:05:36,860 --> 00:05:43,280
and remember that in our project there was a file called B.A.P File, and inside of this file you'll

72
00:05:43,280 --> 00:05:46,910
see a list of packages that our application depends on.

73
00:05:47,120 --> 00:05:54,210
For instance, flask request python, not envy for squirrels and also their packages like BlackBerry

74
00:05:54,210 --> 00:05:55,100
Island and so on.

75
00:05:55,880 --> 00:06:01,460
But in order to run our application, we actually require only those packages that are listed under

76
00:06:01,460 --> 00:06:02,570
the packages section.

77
00:06:03,320 --> 00:06:07,700
Their packages are acquired only during development brought us this way.

78
00:06:07,710 --> 00:06:12,170
Basically, Insider was a Docker container that will be created based on the image.

79
00:06:12,590 --> 00:06:14,830
We don't require day of packages.

80
00:06:14,840 --> 00:06:18,680
We only need those packages listed here under this section.

81
00:06:19,520 --> 00:06:21,580
This way, now inside there was a Docker file.

82
00:06:21,590 --> 00:06:28,100
We will add some Docker instructions for installation of all those packages from this baby file.

83
00:06:28,580 --> 00:06:35,630
Let's do that here in Docker file and next command, we'll be following run and after run you need to

84
00:06:35,630 --> 00:06:41,770
type specific command and first command will be pipe install baby.

85
00:06:41,810 --> 00:06:44,600
And we record that we used baby.

86
00:06:44,840 --> 00:06:52,030
And we also call it on our computers for creation of the Python environment because we are running API

87
00:06:52,050 --> 00:06:58,430
service inside of the Python environment, inside of the container that will be based on this Docker

88
00:06:58,430 --> 00:06:58,850
image.

89
00:06:59,270 --> 00:07:05,060
We will run our application directly without Python view environment.

90
00:07:05,990 --> 00:07:06,420
Why?

91
00:07:06,650 --> 00:07:13,280
Because there was no need to create separate virtual environment for our based servers because container

92
00:07:13,310 --> 00:07:15,250
will be sole purpose.

93
00:07:15,260 --> 00:07:17,960
It will around only our single application.

94
00:07:18,380 --> 00:07:24,110
This way, we are able to very easily install all dependencies globally in that container.

95
00:07:24,290 --> 00:07:32,120
No need for creation of the python environment, but we need to install some all dependencies of our

96
00:07:32,120 --> 00:07:32,660
project.

97
00:07:32,990 --> 00:07:35,390
And for that, we could utilize pipe.

98
00:07:36,680 --> 00:07:46,550
And using cap envy, we are able to generate special tax file for people with least of all dependencies

99
00:07:46,550 --> 00:07:49,170
of our application and afterwards using.

100
00:07:49,950 --> 00:07:54,260
We will install all dependencies globally inside of this image.

101
00:07:54,830 --> 00:08:00,170
So let's add one more run command and it will be the HP Envy.

102
00:08:00,320 --> 00:08:09,100
Look, there's this requirements like that greater than sign and hero type requirements, not DSD.

103
00:08:10,100 --> 00:08:18,010
Would this command essentially will do it will use envy in order to create a list of all requirements

104
00:08:18,530 --> 00:08:24,320
Romsey, P, P, E and V file this file that we have inside of our application.

105
00:08:25,710 --> 00:08:33,720
But at the moment, this baby file is absent in this image, and this way, before Ron those comments,

106
00:08:34,110 --> 00:08:43,830
we need to copy both AP File and AP file a block from the API folder to the UP folder in the image.

107
00:08:44,750 --> 00:08:47,690
And for that, we need to use one more instruction called Scorpion.

108
00:08:47,990 --> 00:08:54,590
And we could add somewhere before Rahm commands, for instance, here scorpion and in command, you

109
00:08:54,590 --> 00:08:58,280
need to specify the source path and destination path.

110
00:08:58,880 --> 00:08:59,900
Let's first copy.

111
00:09:00,050 --> 00:09:07,310
AP File This file is located in the route of the EPA folder here at the same level as local file.

112
00:09:07,610 --> 00:09:14,150
That's why you could simply type like that copy paper file without a path to it and afterwards will

113
00:09:14,150 --> 00:09:15,170
be destination path.

114
00:09:15,800 --> 00:09:19,940
And this scope is simply using Path Dot for what's less like that.

115
00:09:20,980 --> 00:09:29,260
And in such case, Doro will actually copy such file Bapu file, who's up working directory because

116
00:09:29,260 --> 00:09:32,260
here we help separate instruction work dear.

117
00:09:33,680 --> 00:09:40,070
Also, we need to copy the AP file, but look in order to install exact versions of all packages for

118
00:09:40,070 --> 00:09:46,430
that, we could use one or more command Copia, the AP file the blog and let's copy it to the same destination

119
00:09:46,430 --> 00:09:46,940
folder.

120
00:09:47,150 --> 00:09:48,410
Vote for what's less.

121
00:09:48,770 --> 00:09:53,350
You discount working directory inside of the image if you want.

122
00:09:53,360 --> 00:10:00,230
You could also combine those two copy commands and Typekit one line with copy this file name like that

123
00:10:00,230 --> 00:10:01,190
and paste here.

124
00:10:01,460 --> 00:10:02,700
And it will also work.

125
00:10:02,750 --> 00:10:04,910
Same as those two different commands.

126
00:10:06,240 --> 00:10:12,480
With this instruction in place, Dulquer will equip you two files, the AP file and the AP file that

127
00:10:12,480 --> 00:10:16,020
log to the working directory inside of the image.

128
00:10:16,980 --> 00:10:19,500
And this way I have to run this command.

129
00:10:20,040 --> 00:10:23,700
We will get File Gold Requirements Directive.

130
00:10:24,390 --> 00:10:32,430
It will be created inside of the Docker image, and this file will contain least of all project dependencies

131
00:10:32,670 --> 00:10:36,480
retrieved from zip file and baby file that look.

132
00:10:37,260 --> 00:10:44,970
And this way, we needed to install the API in V dependency because it knows how to extract all packages

133
00:10:45,210 --> 00:10:48,700
from those files to the text file requirements.

134
00:10:50,040 --> 00:10:56,550
And now, using one more command, we are able to install all dependencies listed in these requirements.

135
00:10:56,550 --> 00:10:59,520
But the file and this command is falling.

136
00:10:59,520 --> 00:11:05,030
Baby install this our requirements note.

137
00:11:06,630 --> 00:11:14,010
And after such command, baby will globally in terms of python install all necessary for our application

138
00:11:14,010 --> 00:11:16,680
requirements like flask and others.

139
00:11:17,250 --> 00:11:22,920
Again, there was no need for creation of the separate Python beautiful environment inside of the container,

140
00:11:23,520 --> 00:11:30,150
so this whole necessary requirements will be installed inside of the Docker image and next command will

141
00:11:30,150 --> 00:11:36,180
be copied and we will copy all remaining application files you as a source.

142
00:11:36,210 --> 00:11:42,750
You'll need to type only dot and this nation will be working directory that is represented using Dorton

143
00:11:42,750 --> 00:11:48,390
for what's less so after installation of all those dependencies.

144
00:11:49,080 --> 00:11:57,350
We copy all remaining application files from the API folder and print such file as amended to.

145
00:11:57,360 --> 00:11:59,790
I will be copied to the image.

146
00:12:11,760 --> 00:12:17,010
And lost dog construction, this dog profile will be seemed the stance for comment.

147
00:12:17,520 --> 00:12:23,760
And here in square brackets, we need to put executable along with parameters if necessary.

148
00:12:24,620 --> 00:12:31,670
And this command will be executed when actual, a container that will be based on this image will be

149
00:12:31,670 --> 00:12:32,270
started.

150
00:12:33,080 --> 00:12:33,890
And we'll keep that.

151
00:12:33,890 --> 00:12:39,530
We started our obligation using command python and named the file man to do.

152
00:12:40,100 --> 00:12:42,630
We did that in Python brutal environment.

153
00:12:42,650 --> 00:12:43,690
Here you see the python.

154
00:12:43,690 --> 00:12:47,530
A built environment was activated using a command baby and B cell.

155
00:12:47,960 --> 00:12:52,910
And now in the FBI folder, I could run our eBay service using a command.

156
00:12:52,910 --> 00:12:59,720
Python waned or try and floss web server was just started at broad 50 50.

157
00:13:00,140 --> 00:13:02,570
Let's stop it in the same way.

158
00:13:02,750 --> 00:13:09,910
We will start by a flask service inside of the container using the command python and name of the file

159
00:13:09,920 --> 00:13:10,850
man that boy.

160
00:13:11,540 --> 00:13:19,520
Let's do that here in the command instruction thrust element here in this array will be Python like

161
00:13:19,520 --> 00:13:19,820
that.

162
00:13:20,270 --> 00:13:23,750
And second, one will be parameter, and that is name of the file.

163
00:13:24,040 --> 00:13:25,280
When do I?

164
00:13:26,380 --> 00:13:31,570
And again, such comment by the blast that I will be executed each time.

165
00:13:31,720 --> 00:13:33,640
One container is started.

166
00:13:34,300 --> 00:13:39,820
And notice that here I don't need to specify Python three or any other version of the Python, just

167
00:13:39,820 --> 00:13:40,330
python.

168
00:13:40,630 --> 00:13:46,270
Because here inside of this container, there will be only one part in the version available.

169
00:13:46,510 --> 00:13:47,500
3.9.

170
00:13:48,100 --> 00:13:52,080
And this Python executable points of growth to this version.

171
00:13:52,120 --> 00:13:52,780
3.9.

172
00:13:53,500 --> 00:13:53,950
All right.

173
00:13:54,190 --> 00:13:57,010
This ID for this doggerel file, let's save it.

174
00:13:57,010 --> 00:14:04,270
And let's summarize what happens here on the first line we use base image and despite them, version

175
00:14:04,270 --> 00:14:11,410
3.9 and inside of this image, there was already Python preinstalled along with B.A.P that we need here

176
00:14:11,410 --> 00:14:13,390
in order to install all dependencies.

177
00:14:14,320 --> 00:14:20,980
Next, using work word instruction whispers, a five path working directory inside of the container

178
00:14:21,430 --> 00:14:22,900
and that is folder up.

179
00:14:23,200 --> 00:14:29,290
You could choose any name you want after world using export instruction with withheld that we want to

180
00:14:29,290 --> 00:14:31,230
export brought 50 50.

181
00:14:31,240 --> 00:14:34,840
That is that brought where we were on our Python floor script, cetera.

182
00:14:35,710 --> 00:14:39,510
Next, we copy two files Baby File and Baby File.

183
00:14:39,520 --> 00:14:43,680
Both look from Folder, where our Docker file is located.

184
00:14:43,690 --> 00:14:45,100
It is API folder.

185
00:14:45,250 --> 00:14:52,690
Here are those two files and we compared them to the image to working directory that is fight here.

186
00:14:52,690 --> 00:14:53,620
Isn't this come out?

187
00:14:54,650 --> 00:14:56,810
Next, we run three different commands.

188
00:14:57,110 --> 00:15:04,520
First one to be installed, baby in view and using baby, we installed baby and view package afterwards

189
00:15:04,520 --> 00:15:05,800
using baby envy.

190
00:15:06,180 --> 00:15:09,370
Weekly text file gold requirements data.

191
00:15:10,370 --> 00:15:17,060
Based on those two files and all dependencies of the API service are extracted to the requirements file

192
00:15:17,600 --> 00:15:23,180
and afterward, using kabab, we install all dependencies from this file.

193
00:15:24,080 --> 00:15:30,800
After this moment, inside of the image, there will be all necessary dependencies of our own API application

194
00:15:31,280 --> 00:15:33,620
and they will be installed globally.

195
00:15:33,710 --> 00:15:38,960
We don't create B.A.P in the environment because there is no need for DEP.

196
00:15:39,650 --> 00:15:43,880
Container will be single purpose run python application.

197
00:15:43,910 --> 00:15:47,210
There will be no other applications running this way.

198
00:15:47,330 --> 00:15:51,650
It makes sense to install all the requirements globally inside of the image.

199
00:15:52,400 --> 00:15:59,810
All right, after that, we copy all remaining files from the API folder to the working directory.

200
00:16:00,200 --> 00:16:07,340
It is still up folder inside of the image, and finally, we add, seemed instruction that will run

201
00:16:07,430 --> 00:16:12,440
main file using Python executable inside of the container.

202
00:16:13,040 --> 00:16:19,100
In total, in this Docker file, there are eight steps and the Docker went will build Docker.

203
00:16:19,100 --> 00:16:23,630
Image will go through each instruction one by one step by step.

204
00:16:24,740 --> 00:16:25,160
All right.

205
00:16:25,370 --> 00:16:29,210
Make sure you save the file and then the next lecture of the small bills.

206
00:16:29,360 --> 00:16:32,480
We will build image using this doggerel file.

207
00:16:32,640 --> 00:16:33,560
I'll see you guys next.

