1
00:00:04,290 --> 00:00:04,860
All right.

2
00:00:04,860 --> 00:00:06,900
I hope you were able to complete this challenge.

3
00:00:06,900 --> 00:00:12,330
And now let's do the together and I'll first prepare our commands in VS code file.

4
00:00:12,360 --> 00:00:18,480
I have already created the folder called Elasticsearch, and here inside there is already a file called

5
00:00:18,480 --> 00:00:25,170
Elasticsearch dash commands dot txt and you are able to find this file basically in GitHub repository,

6
00:00:25,170 --> 00:00:27,930
but we will use it in the next lecture.

7
00:00:27,930 --> 00:00:36,150
Now I'll create a new file here in this folder named commands dot txt, same as we did for WordPress

8
00:00:36,150 --> 00:00:37,470
and MySQL.

9
00:00:37,470 --> 00:00:43,410
Examples commands, dot txt and here first command will be creation of the custom network.

10
00:00:44,010 --> 00:00:53,820
Create new custom bridge network and I'll use here command Docker network.

11
00:00:54,600 --> 00:00:59,010
Create and name of this custom network will be elastic.

12
00:01:00,230 --> 00:01:01,340
Search like this.

13
00:01:01,370 --> 00:01:05,300
Next create elastic search container.

14
00:01:05,450 --> 00:01:10,700
Elastic search container like.

15
00:01:10,700 --> 00:01:14,810
So here I will use Docker run command.

16
00:01:14,840 --> 00:01:20,090
I will use backslashes to separate different sub parts of the same command.

17
00:01:20,090 --> 00:01:24,710
And next, let me give name to this container name.

18
00:01:25,370 --> 00:01:27,320
Elastic search like so.

19
00:01:27,350 --> 00:01:30,950
Next, I have asked you to create port mapping.

20
00:01:30,980 --> 00:01:35,400
Here will be dash and external port will be 90 200.

21
00:01:35,420 --> 00:01:42,260
Same as internal port 90 200 will expose same port to outside.

22
00:01:42,290 --> 00:01:44,420
Next, let's specify here.

23
00:01:44,420 --> 00:01:49,580
Name of the image and name will be elastic search like so.

24
00:01:49,580 --> 00:01:54,530
And also let's run this container in background but it is optional.

25
00:01:54,530 --> 00:01:57,080
You could run it in foreground if you want.

26
00:01:57,110 --> 00:02:04,580
Also we need to specify here custom network name dash dash, network and name will be elastic search.

27
00:02:04,590 --> 00:02:08,039
It is a name of this network we have created here above.

28
00:02:08,220 --> 00:02:12,340
And it seems that that's all what I asked you to do.

29
00:02:12,360 --> 00:02:16,440
Alright, next container will be container.

30
00:02:16,440 --> 00:02:22,140
Create URL container and here we will use again.

31
00:02:22,140 --> 00:02:23,700
Sorry, I have forgotten to add here.

32
00:02:23,700 --> 00:02:24,810
Backslashes.

33
00:02:24,810 --> 00:02:26,520
Like so backslash.

34
00:02:26,520 --> 00:02:28,860
Here, here and here and here.

35
00:02:28,860 --> 00:02:35,130
Let's create see container docker run backslash network will be the same.

36
00:02:35,130 --> 00:02:37,200
Let me copy this command from here.

37
00:02:37,770 --> 00:02:39,290
Paste like so.

38
00:02:39,300 --> 00:02:41,760
Next let's give it also name.

39
00:02:42,430 --> 00:02:51,070
Does this name and name will be, let's say simply and we will not expose any ports.

40
00:02:51,460 --> 00:02:55,630
And here next will be name of the image we want to use.

41
00:02:55,660 --> 00:03:03,640
And the name of the image is Let me go to history somewhere here and let me copy image name from here.

42
00:03:03,820 --> 00:03:04,120
Okay.

43
00:03:04,120 --> 00:03:14,200
Let me go back to VS code and let me paste the image name here and I'll want to override default command

44
00:03:14,230 --> 00:03:21,940
that is hardcoded into this image and I want to override it with command or you are able to use bash

45
00:03:21,940 --> 00:03:25,450
command as well, but I'll use here like so.

46
00:03:25,630 --> 00:03:31,780
And it seems that that's all that we want to do in order to run those two containers.

47
00:03:31,780 --> 00:03:37,540
Let me quickly check network is Elasticsearch here here and we create network here.

48
00:03:37,540 --> 00:03:45,890
We expose port here and also we will be able to reach to this container by its name, Elasticsearch.

49
00:03:45,890 --> 00:03:47,180
That's actually the purpose.

50
00:03:47,180 --> 00:03:51,290
Why I have asked you to create separate custom network.

51
00:03:51,650 --> 00:03:52,490
All right.

52
00:03:52,490 --> 00:03:55,220
Let me first create this custom network.

53
00:03:55,220 --> 00:03:59,540
Let me copy it and go to terminal create new custom network.

54
00:03:59,540 --> 00:04:01,070
Network was created.

55
00:04:01,070 --> 00:04:03,800
Let me now run Elasticsearch container.

56
00:04:03,800 --> 00:04:07,220
At the moment I don't have Elasticsearch image in local hash.

57
00:04:07,220 --> 00:04:09,440
That's why first we need to pull it.

58
00:04:09,440 --> 00:04:14,510
But basically with Docker run command, we will first pull it and afterwards immediately create container

59
00:04:14,510 --> 00:04:15,230
out of it.

60
00:04:15,230 --> 00:04:19,010
But actually, let me quickly check the name of this image.

61
00:04:19,010 --> 00:04:23,690
Let me go to Docker Hub and check whether name is correct.

62
00:04:23,810 --> 00:04:27,440
Elastic search like so.

63
00:04:27,560 --> 00:04:29,120
And yes, image is correct.

64
00:04:29,120 --> 00:04:35,570
There is official Docker image called Elasticsearch and there are more than 1 million downloads.

65
00:04:35,600 --> 00:04:36,080
Great.

66
00:04:36,080 --> 00:04:38,690
Let me go back to this file.

67
00:04:38,690 --> 00:04:40,820
Let me copy this command.

68
00:04:40,820 --> 00:04:46,340
Go to terminal and let me launch Elasticsearch container here.

69
00:04:46,490 --> 00:04:52,940
Unable to find image locally and there is an error manifest for Elasticsearch.

70
00:04:52,940 --> 00:04:54,230
Latest not found.

71
00:04:54,260 --> 00:04:55,010
Let me check.

72
00:04:55,010 --> 00:04:57,770
Probably there is some error here.

73
00:04:57,770 --> 00:04:59,810
Let me go into this.

74
00:05:01,260 --> 00:05:02,250
Container.

75
00:05:02,280 --> 00:05:05,910
Let me copy basically this command and let me try to pull it first.

76
00:05:07,860 --> 00:05:14,430
Docker pull Elasticsearch and name is exactly the same as I have used here.

77
00:05:14,970 --> 00:05:15,740
Strange.

78
00:05:15,750 --> 00:05:17,790
Let me try to pull it like so.

79
00:05:19,280 --> 00:05:22,190
It seems that at the moment the tag latest.

80
00:05:22,370 --> 00:05:27,290
For some reason is not assigned to any image of Elasticsearch versions.

81
00:05:27,290 --> 00:05:32,060
And yes, that is the case and we need to specify exact tags.

82
00:05:32,390 --> 00:05:34,340
Either this one or this one.

83
00:05:34,340 --> 00:05:38,270
Let me use this tag and let me modify command here.

84
00:05:39,060 --> 00:05:42,950
If you got the same error, please repeat this step along with me.

85
00:05:42,960 --> 00:05:46,830
So let's pull specific image of Elasticsearch.

86
00:05:46,860 --> 00:05:48,920
Let me copy this command.

87
00:05:48,930 --> 00:05:49,710
Save this file.

88
00:05:49,740 --> 00:05:54,480
By the way, let me go back to terminal and paste the copied command like so.

89
00:05:56,060 --> 00:05:56,480
All right.

90
00:05:56,510 --> 00:05:58,610
Now we are pulling image from Docker Hub.

91
00:05:59,180 --> 00:06:02,210
It is strange that the latest tech isn't available.

92
00:06:02,210 --> 00:06:02,990
I don't know why.

93
00:06:03,020 --> 00:06:03,950
For some reason.

94
00:06:05,080 --> 00:06:05,440
Okay.

95
00:06:05,440 --> 00:06:09,220
Image was finally downloaded and the new container was created.

96
00:06:09,220 --> 00:06:13,450
And here I see Sha1 hash of this newly created container.

97
00:06:13,480 --> 00:06:15,970
Let me verify whether it is running or not.

98
00:06:16,000 --> 00:06:21,310
Docker PS and yes, I see that Elasticsearch container is now currently running.

99
00:06:21,340 --> 00:06:23,020
Here is the container ID.

100
00:06:23,170 --> 00:06:26,830
Here is image that was used in this image with custom tag.

101
00:06:26,830 --> 00:06:28,930
And also you see here port mapping.

102
00:06:28,930 --> 00:06:33,250
We have exposed port 92 002 outside.

103
00:06:33,280 --> 00:06:37,420
There is also another port that Elasticsearch server listens to.

104
00:06:37,450 --> 00:06:39,190
It is 90 300.

105
00:06:39,190 --> 00:06:45,490
But I didn't ask you to expose it because this port is usually used for internal communication between

106
00:06:45,490 --> 00:06:47,410
different Elasticsearch servers.

107
00:06:47,440 --> 00:06:49,240
At the moment we have only one server.

108
00:06:49,240 --> 00:06:52,720
That's why there is no need to expose this port outside.

109
00:06:52,720 --> 00:06:53,140
Great.

110
00:06:53,140 --> 00:06:56,710
And here I also see custom name for this container.

111
00:06:56,740 --> 00:06:59,980
Let me now start to see container.

112
00:06:59,980 --> 00:07:04,330
Let me go back to those commands and I'll use this command.

113
00:07:04,330 --> 00:07:06,350
Let me copy it from here.

114
00:07:08,010 --> 00:07:11,730
Go back to terminal and paste it like so.

115
00:07:12,030 --> 00:07:14,210
Sorry, I have forgotten to add here.

116
00:07:14,220 --> 00:07:15,600
Dash options.

117
00:07:15,930 --> 00:07:16,590
All right.

118
00:07:16,590 --> 00:07:18,720
Let me try to add them here in.

119
00:07:19,530 --> 00:07:20,640
This file.

120
00:07:22,190 --> 00:07:23,990
This team like.

121
00:07:23,990 --> 00:07:28,340
So let me try to copy this command over again.

122
00:07:28,460 --> 00:07:29,750
Paste it here.

123
00:07:30,290 --> 00:07:32,720
Docker Container Prune.

124
00:07:33,570 --> 00:07:34,410
Yes.

125
00:07:36,510 --> 00:07:38,280
Again, rerun this command.

126
00:07:38,960 --> 00:07:40,950
And now I'm in hell.

127
00:07:41,300 --> 00:07:46,010
Let me open up a web browser and verify connection to Elasticsearch.

128
00:07:46,040 --> 00:07:52,160
Recap that we have exposed port 90 200 and I'm able to use localhost here.

129
00:07:53,860 --> 00:07:54,820
And port.

130
00:07:56,350 --> 00:07:58,090
90 200.

131
00:07:59,820 --> 00:08:01,560
The page isn't working.

132
00:08:02,040 --> 00:08:09,100
Let me go back to terminal and verify again whether server is running and it seems that it was exited.

133
00:08:09,120 --> 00:08:10,020
Let me verify.

134
00:08:10,050 --> 00:08:11,520
Logs for this container.

135
00:08:11,550 --> 00:08:13,170
Docker Logs.

136
00:08:13,860 --> 00:08:15,630
Elasticsearch.

137
00:08:17,780 --> 00:08:26,180
There are some logs related to shutdown of the Elasticsearch server stopping.

138
00:08:28,080 --> 00:08:30,780
Actually, I don't know the reason why it stopped.

139
00:08:30,810 --> 00:08:38,070
Basically, let me quickly go to official page for Elasticsearch Image and check whether we started

140
00:08:38,070 --> 00:08:39,240
correctly or not.

141
00:08:41,250 --> 00:08:42,390
Run Elasticsearch.

142
00:08:42,390 --> 00:08:44,960
Here is name Custom network.

143
00:08:44,970 --> 00:08:49,110
Okay, two ports exposed, but we basically don't need the second port.

144
00:08:49,110 --> 00:08:54,240
And here you see additional environment variable discovery type single node.

145
00:08:55,220 --> 00:08:56,650
Probably that is the reason.

146
00:08:56,660 --> 00:08:59,470
Let me copy actually this environment variable setting.

147
00:08:59,480 --> 00:09:05,180
Go to this command and add it here like so let me save the file.

148
00:09:05,180 --> 00:09:10,730
And now let me remove Elasticsearch container that is running and let me start over.

149
00:09:10,730 --> 00:09:11,660
New container.

150
00:09:11,660 --> 00:09:15,980
Let me clear terminal Docker RM Elasticsearch.

151
00:09:17,020 --> 00:09:18,280
Container was removed.

152
00:09:18,280 --> 00:09:20,140
Let me copy this command.

153
00:09:20,230 --> 00:09:21,820
Let me actually remove.

154
00:09:22,240 --> 00:09:26,200
Option and start the Elasticsearch container in foreground.

155
00:09:26,200 --> 00:09:28,100
Let me copy this command.

156
00:09:28,120 --> 00:09:29,110
Go here.

157
00:09:33,580 --> 00:09:34,360
All right.

158
00:09:35,790 --> 00:09:39,780
Information about open JDK version.

159
00:09:40,890 --> 00:09:47,940
Elasticsearch actually requires Java Development kit to be running in order to be able to start.

160
00:09:50,000 --> 00:09:52,800
Some modules are being loaded right now.

161
00:09:52,820 --> 00:09:54,230
Here is version.

162
00:09:55,140 --> 00:09:56,550
762.

163
00:09:57,650 --> 00:09:58,640
Starting.

164
00:09:59,660 --> 00:10:01,460
Security disabled.

165
00:10:02,800 --> 00:10:04,820
Active license is now basic.

166
00:10:04,840 --> 00:10:05,380
All right.

167
00:10:05,380 --> 00:10:08,290
It seems that now server is running.

168
00:10:08,290 --> 00:10:12,430
Let me go back to Chrome and refresh page here.

169
00:10:13,870 --> 00:10:15,460
And now I get a result.

170
00:10:15,460 --> 00:10:20,020
And it seems that the problem was in that custom environment.

171
00:10:20,020 --> 00:10:22,360
Variable discovery type single node.

172
00:10:22,390 --> 00:10:23,230
All right.

173
00:10:23,230 --> 00:10:29,470
Now we have elastic storage server running and also we have see container running.

174
00:10:29,500 --> 00:10:38,890
Let me go to see container here and let me try to ping elasticsearch container ping, elastic search

175
00:10:38,890 --> 00:10:45,670
like so and I get a result and that means that we are now able to reach elastic search server by its

176
00:10:45,670 --> 00:10:48,220
name name of the container elastic search.

177
00:10:48,220 --> 00:10:52,030
And here is IP address that was assigned to Elasticsearch container.

178
00:10:52,180 --> 00:10:52,710
Great.

179
00:10:52,720 --> 00:10:53,710
Now we are all set.

180
00:10:53,710 --> 00:10:58,270
And the next let's perform some actions with Elasticsearch server.

181
00:10:58,270 --> 00:11:02,770
Let's create a new index and let's insert some documents in that index.

182
00:11:02,770 --> 00:11:05,290
And afterwards let's perform some searches.

183
00:11:05,290 --> 00:11:06,220
I'll see you next.

184
00:11:06,220 --> 00:11:06,870
Bye bye.

