1
00:00:04,330 --> 00:00:04,800
All right.

2
00:00:04,990 --> 00:00:10,480
We just successfully built a Docker image for our API service, and there was a corresponding image

3
00:00:10,480 --> 00:00:16,239
available for use here with this note, please ensure that you are not running API service somewhere

4
00:00:16,239 --> 00:00:16,540
else.

5
00:00:16,720 --> 00:00:21,670
For instance, in Visual Studio Code here, see that there are no protests and there is just single

6
00:00:21,670 --> 00:00:22,510
tap opened.

7
00:00:22,870 --> 00:00:25,810
Also, I am not running API service here.

8
00:00:26,050 --> 00:00:30,970
In this step, I am running on the front end application and I could basically verify that it is not

9
00:00:30,970 --> 00:00:31,810
running here.

10
00:00:32,020 --> 00:00:36,910
Let me open up a new tap and enter local host and report for you.

11
00:00:36,970 --> 00:00:40,900
If you do like that and I see that this site can be reached.

12
00:00:41,620 --> 00:00:47,830
Let's create a new container based on this image, and for that you need to use command Docker run.

13
00:00:48,310 --> 00:00:55,710
Let's run a new container and live export brought using this option and the list by here folding 50.

14
00:00:55,720 --> 00:01:02,080
If you have to own 50 50 in the moment, I'll explain to you what happens here and afterwards will specify

15
00:01:02,080 --> 00:01:05,230
which image we want to use for this particular container.

16
00:01:05,590 --> 00:01:09,670
And you could use either image ID or repository name.

17
00:01:09,910 --> 00:01:15,310
Let's use a repository name, images, gallery API like that, and let's press enter.

18
00:01:18,070 --> 00:01:21,370
And I see that Flask Web server started successfully.

19
00:01:21,610 --> 00:01:23,980
And it is running at broad 50 50.

20
00:01:24,190 --> 00:01:30,040
And I even see such a request that came from the web browser, and it seems that the web browser attempted

21
00:01:30,040 --> 00:01:31,990
to out or refresh this page.

22
00:01:32,290 --> 00:01:37,780
And of course, now when it attempts to access a root URL, I see a response not found.

23
00:01:38,020 --> 00:01:43,780
And the reason why we get here, not found, is that in our flask application, we didn't add any handler

24
00:01:43,900 --> 00:01:46,290
for root, the URL for what's less.

25
00:01:46,750 --> 00:01:50,830
That's why it automatically wrote Don't ask respawn scored four or four.

26
00:01:50,830 --> 00:01:52,390
Not found no.

27
00:01:52,400 --> 00:01:58,150
Let's test our eBay service, and there was only a single API endpoint that we able to test and add

28
00:01:58,150 --> 00:01:59,560
the so-called new image.

29
00:01:59,770 --> 00:02:06,880
Let me go here to when you are a file and here with this end point, so up to throw out a new image.

30
00:02:07,450 --> 00:02:09,699
Let's test it and let's go to web browser.

31
00:02:09,699 --> 00:02:11,770
And here, let's add for what's less.

32
00:02:12,040 --> 00:02:15,790
Basically, I have it here in the dropdown, and let's keep query, Karl.

33
00:02:16,270 --> 00:02:17,700
Let's check whether it works or not.

34
00:02:17,710 --> 00:02:20,280
And yes, I got response from the US place.

35
00:02:20,860 --> 00:02:28,510
It means that now our API service works as before, but now it works inside of the Docker container.

36
00:02:29,410 --> 00:02:35,530
But what is the difference between running this eBay service locally, as we did before and inside is

37
00:02:35,530 --> 00:02:36,400
a Docker container?

38
00:02:37,270 --> 00:02:38,380
Let me demonstrate to you.

39
00:02:38,650 --> 00:02:45,690
Let me open up a new tab here like that and let me again list Docker images, Docker images, and no,

40
00:02:45,700 --> 00:02:49,510
let's create one more container from the same Docker image.

41
00:02:49,600 --> 00:02:58,830
This one image gallery API and belittled and fallen way Docker Run DSP also lets export abroad and heal

42
00:02:58,840 --> 00:03:03,500
this Typekit 50 50 again, same as we did in this example.

43
00:03:03,730 --> 00:03:08,230
50 50 and afterwards article let's type 55 do.

44
00:03:08,650 --> 00:03:12,580
And here let's use same image image gallery API.

45
00:03:13,120 --> 00:03:15,300
Let's press, enter and see what will happen.

46
00:03:15,940 --> 00:03:21,690
And I see error from Docker error response from Daemon Driver or failed programming.

47
00:03:21,700 --> 00:03:29,620
External connectivity on end point by point four four zero 50 50 failed port is already allocated,

48
00:03:30,400 --> 00:03:34,150
and the reason for that is that we are already running one Docker container.

49
00:03:34,660 --> 00:03:43,000
didThe occupies external port 50 50 and difference between those two ports is following this.

50
00:03:43,000 --> 00:03:50,260
Broad is broad that is open inside of the container, and on this broad we run flask API service inside

51
00:03:50,260 --> 00:03:51,370
of the container here.

52
00:03:52,770 --> 00:04:00,060
And now, if you want to access any services inside of the container, you want to bind local port to

53
00:04:00,060 --> 00:04:01,710
external brought on your computer.

54
00:04:02,310 --> 00:04:09,840
And this way we used such option as this be the stealth for published here with specifically local port

55
00:04:09,840 --> 00:04:10,840
on our computer.

56
00:04:11,610 --> 00:04:12,900
And here with bits.

57
00:04:12,900 --> 00:04:20,010
If I brought inside of the container and Docker maps, this external brought on your computer to internal

58
00:04:20,010 --> 00:04:21,480
port of the container.

59
00:04:21,959 --> 00:04:26,240
And this way we were able to access this web page using brought a 50.

60
00:04:26,820 --> 00:04:33,420
This request to our local computer and Docker has brought such a request to this container.

61
00:04:34,080 --> 00:04:40,320
But now, of course, we are not able to reuse same local port on our computers because now it is occupied

62
00:04:40,320 --> 00:04:41,200
by this container.

63
00:04:41,730 --> 00:04:46,980
And this way, now if we want to create one more container from the same image, we need to use another

64
00:04:46,980 --> 00:04:47,490
support.

65
00:04:47,790 --> 00:04:53,640
And let's do that and let's modify probably support from 50 50 dollar, say, 50 51.

66
00:04:53,970 --> 00:04:59,460
You could add here any port you like, but of course, this broad that is brought inside of the container

67
00:04:59,580 --> 00:05:03,840
must remain 50-50 because it is that brought where we start.

68
00:05:03,960 --> 00:05:05,100
Flask Web server.

69
00:05:05,670 --> 00:05:06,090
All right.

70
00:05:06,270 --> 00:05:10,140
Let's now try to run this container run.

71
00:05:11,500 --> 00:05:14,110
And I see that the Flask Web server started.

72
00:05:14,620 --> 00:05:22,660
And here I see exactly the same log as in this output because internally inside of the Container Flask

73
00:05:22,660 --> 00:05:26,110
web server is running at the same port brought 50 50.

74
00:05:26,740 --> 00:05:34,630
But now we expose those flask web servers to different external boards on our computers, and we could

75
00:05:34,630 --> 00:05:36,460
now test it in a web browser.

76
00:05:36,730 --> 00:05:44,830
Let me copy this URL Gordon UTEP wasted here, but no, I will change this port 55 to two Port 5:51

77
00:05:44,830 --> 00:05:45,490
Like this?

78
00:05:46,210 --> 00:05:50,200
Let's now see what we'll get, and I get response from the bliss.

79
00:05:50,680 --> 00:05:54,910
And now this request was processed by this second container.

80
00:05:55,150 --> 00:05:56,920
Here you see two different requests.

81
00:05:57,310 --> 00:06:03,310
One request to the new image and point and another one for federal by the cone, of course, was not

82
00:06:03,310 --> 00:06:09,340
found and the server returned code four or four because we didn't add the Vatican in the flask web.

83
00:06:09,340 --> 00:06:11,860
Cetera, but you got an idea.

84
00:06:12,430 --> 00:06:18,940
Now we are able to process a request in both containers and you could create as many containers as you

85
00:06:18,940 --> 00:06:19,300
like.

86
00:06:19,570 --> 00:06:25,990
All of them will perform same operations because all of them are running exactly the same code base.

87
00:06:26,650 --> 00:06:33,250
And now, in order to run API service, we basically don't require those files in our images gallery

88
00:06:33,250 --> 00:06:33,910
folder.

89
00:06:33,940 --> 00:06:40,090
I mean, API subfolder and others, you could simply delete them and use only Docker images.

90
00:06:40,240 --> 00:06:41,200
This how it works.

91
00:06:41,710 --> 00:06:48,760
All those files, including, for instance, may end up by a file e needed local file, even all located

92
00:06:48,910 --> 00:06:49,420
inside.

93
00:06:49,420 --> 00:06:56,740
There was a Docker image because here on this line, we actually corbet all application files to the

94
00:06:56,740 --> 00:07:02,050
image, and now you're able to reuse it multiple times and create different containers.

95
00:07:02,920 --> 00:07:03,310
All right.

96
00:07:03,580 --> 00:07:05,840
Let's no stop this second container.

97
00:07:05,860 --> 00:07:07,120
We don't need it anymore.

98
00:07:07,690 --> 00:07:12,010
And no, if I anti-Europeans repeals, I'll see only one container does running.

99
00:07:12,640 --> 00:07:14,910
And here was binding of the ports.

100
00:07:14,920 --> 00:07:20,860
We bind a local a port on our computers 550 to port, 50:50 inside of the container.

101
00:07:21,830 --> 00:07:28,970
He was command that was executed by the man to try this container was created 13 minutes ago.

102
00:07:29,720 --> 00:07:35,390
He was container idea and he was image that was used for running of this container.

103
00:07:36,080 --> 00:07:41,330
Of course, if I try to access this, you're now using 40, 50 51.

104
00:07:41,630 --> 00:07:47,630
I'll get this side can be reached because no second container is stopped and we are not able to access

105
00:07:47,630 --> 00:07:48,290
it anymore.

106
00:07:48,830 --> 00:07:55,850
But we are still able to access this URL at brought 50 50, and here was another response on Splish.

107
00:07:56,360 --> 00:08:01,340
And this response was settled again by this container here with this request.

108
00:08:02,030 --> 00:08:02,450
All right.

109
00:08:02,670 --> 00:08:06,710
Let's know of the small pause explore contents of this container.

110
00:08:07,100 --> 00:08:13,580
And for that, we will open best session to the container and analyze structure of the file system inside

111
00:08:13,580 --> 00:08:14,390
of that container.

112
00:08:14,810 --> 00:08:16,310
I'll see you guys just in a bit.

