1
00:00:04,240 --> 00:00:10,210
We have just agreed that different containers using Mongo image and instead of the one of the containers

2
00:00:10,270 --> 00:00:15,820
we have created the additional database and we have inserted the sum array growth inside of the new

3
00:00:15,820 --> 00:00:20,320
collection called animals and we can verified that in another container.

4
00:00:20,350 --> 00:00:26,090
We don't have access to the same database with same records and that was a good time to explain you

5
00:00:26,110 --> 00:00:33,460
how you able to make let's say persistent database on your local computer and use it from different

6
00:00:33,520 --> 00:00:34,900
Mongo containers.

7
00:00:34,960 --> 00:00:41,390
Same relates actually to either databases like my scribble radius or something else.

8
00:00:41,440 --> 00:00:42,040
Great.

9
00:00:42,040 --> 00:00:49,300
Let me go out from this Mongo shell exit and let me actually stop a bullet actually doors to contain

10
00:00:49,300 --> 00:00:52,670
there was that we have created Docker yes Dash 8.

11
00:00:53,080 --> 00:01:02,810
And let me remove this one and this one I'll use docker container broom command and remove all containers

12
00:01:03,320 --> 00:01:03,620
type.

13
00:01:03,620 --> 00:01:04,310
Yes.

14
00:01:04,550 --> 00:01:06,950
And if I'll have a look at containers now.

15
00:01:07,280 --> 00:01:09,450
Yes there was still one container running.

16
00:01:09,470 --> 00:01:10,670
Let me stop it first.

17
00:01:10,730 --> 00:01:11,400
Darkness stop.

18
00:01:11,460 --> 00:01:14,990
57 and let me actually.

19
00:01:14,990 --> 00:01:21,530
Before deleting it let me launch it over again and the show you weekly where our database is actually

20
00:01:21,530 --> 00:01:23,300
located inside of the container.

21
00:01:23,630 --> 00:01:27,500
Sorry for that let me start it over Docker start.

22
00:01:27,710 --> 00:01:31,650
57 Scalia terminal.

23
00:01:31,710 --> 00:01:33,760
Now it is around here it is.

24
00:01:33,870 --> 00:01:40,440
And no let's open shell brought us and there I'll demonstrate your way our database is located Docker

25
00:01:40,600 --> 00:01:42,720
exec desk.

26
00:01:42,750 --> 00:01:46,270
Item five seven and here type best.

27
00:01:46,310 --> 00:01:47,170
Well let's open up.

28
00:01:47,170 --> 00:01:50,900
Best process and here inside the let's.

29
00:01:51,120 --> 00:01:55,660
The following let's list files and you'll see here folder called data.

30
00:01:55,990 --> 00:02:03,460
Let's list contents of this folder less data and you'll see two sub folders config Debbie and Debbie.

31
00:02:03,920 --> 00:02:06,530
Let's list contents of the Debbie sub folder.

32
00:02:06,550 --> 00:02:08,680
Else data.

33
00:02:09,150 --> 00:02:09,530
Debbie.

34
00:02:10,180 --> 00:02:14,880
And you'll see a bunch of files that are actually related to database.

35
00:02:14,980 --> 00:02:21,760
All those files including the common good dialog a storage B on collection of files while Tiger files

36
00:02:22,120 --> 00:02:25,110
are actually Pirates of Mongo database.

37
00:02:25,330 --> 00:02:31,930
And now every new container that you run using Mongo image creates actually new database inside of this

38
00:02:31,930 --> 00:02:32,570
folder.

39
00:02:32,590 --> 00:02:33,520
Data D.B..

40
00:02:33,640 --> 00:02:38,980
There was also additional folder called config to be but we are interested at the moment only in this

41
00:02:38,980 --> 00:02:39,530
folder.

42
00:02:39,620 --> 00:02:42,180
Deep inside of data folder.

43
00:02:42,200 --> 00:02:48,610
Now let me demonstrate you how we're able to create the database on our local computer and use it inside

44
00:02:48,610 --> 00:02:49,750
of that one container.

45
00:02:50,020 --> 00:02:53,710
And you may guess that for that we will use volume maybe.

46
00:02:53,920 --> 00:02:54,980
And you're right.

47
00:02:55,120 --> 00:02:56,730
Let's clear a terminal here.

48
00:02:56,740 --> 00:02:59,250
Let's actually exit from best shell.

49
00:02:59,390 --> 00:03:06,570
And now let me delete the simply this container the discount Iran and let me stop it darkroom stop.

50
00:03:06,680 --> 00:03:16,000
5 7 and let's remove it Docker are m 5 7 container was removed and there are no containers at the moment

51
00:03:16,370 --> 00:03:19,480
either in history or running great.

52
00:03:19,600 --> 00:03:24,900
Now we are ready to create the volume open and create a database on our local computer.

53
00:03:24,910 --> 00:03:31,120
In my case the smack in the same way you are able to create a volume weapon for Windows or any Unix

54
00:03:31,120 --> 00:03:33,940
like system that the also rans Docker.

55
00:03:34,160 --> 00:03:34,820
Great.

56
00:03:34,900 --> 00:03:38,080
Let me open up our folder here.

57
00:03:38,080 --> 00:03:41,150
Inside of a containers folder and here.

58
00:03:41,170 --> 00:03:47,380
Let's create the new folder near doors folder that we have used in previous lectures and let's create

59
00:03:47,500 --> 00:03:52,710
new folder called Mongo like so and here inside of this folder.

60
00:03:52,780 --> 00:04:02,580
Let's create simply new folder called D.B. like so debut and let's leave this folder empty at the moment.

61
00:04:02,600 --> 00:04:09,540
Now let's go to our timing now and let's see these two Mongo folder in the containers folder in my case

62
00:04:09,540 --> 00:04:11,410
it is located on the desktop.

63
00:04:11,480 --> 00:04:12,560
Let's go to desktop.

64
00:04:12,590 --> 00:04:15,370
Let's go to containers and here let's go to Montego.

65
00:04:15,740 --> 00:04:19,269
And if I'll list files here I I'll see a single folder.

66
00:04:19,279 --> 00:04:22,920
Debbie let's list the contents of this folder at the moment.

67
00:04:23,020 --> 00:04:26,210
Unless Debbie and now this folder is empty.

68
00:04:27,140 --> 00:04:31,430
No let's create new Mongol container using Mongo image.

69
00:04:31,760 --> 00:04:39,870
But now let's create additional volume mapping and endless map this Debbie folder to day ducks less.

70
00:04:39,930 --> 00:04:43,010
Debbie folder inside of the container.

71
00:04:43,040 --> 00:04:45,550
No worries that we have used the same approach before.

72
00:04:45,560 --> 00:04:47,970
So this process is already familiar to you.

73
00:04:48,290 --> 00:04:49,970
Let me actually close this step.

74
00:04:49,970 --> 00:04:51,260
I don't need it anymore.

75
00:04:51,290 --> 00:04:52,970
Let's work Justin this step.

76
00:04:52,970 --> 00:05:01,440
Great Docker run and let's no use this D option in order to lounge Mongo deep waters in background.

77
00:05:01,460 --> 00:05:04,700
Remember we have talked about this option before next.

78
00:05:04,760 --> 00:05:05,760
Let's use.

79
00:05:05,770 --> 00:05:07,630
There should be option volume mapping.

80
00:05:08,030 --> 00:05:11,090
And here I'll use variable B A W dim.

81
00:05:11,120 --> 00:05:17,990
But remember that we want to map Debbie sub folder in the Mongo folder to date that to be folder in

82
00:05:17,990 --> 00:05:18,680
the container.

83
00:05:19,100 --> 00:05:25,780
And for that I could combine variable with relative path and here simply at slash and type DB.

84
00:05:26,000 --> 00:05:29,800
Because we want to map D.B. some folder in the Mongo folder.

85
00:05:29,900 --> 00:05:37,920
Next comes column and afterwards lets bits if I path inside of the container it is data like salt.

86
00:05:38,060 --> 00:05:44,550
Next let's add name of the image Mongo and that's actually all what we need to do in order to start

87
00:05:44,550 --> 00:05:48,600
the new Mongo container using volume mapping.

88
00:05:48,720 --> 00:05:52,060
And again this container will be started in the ground.

89
00:05:52,410 --> 00:05:58,550
When I started we see shock of the newly created container.

90
00:05:58,550 --> 00:06:03,980
And if I'll have a look at contain those now I should see that container is not currently Iran and here

91
00:06:03,980 --> 00:06:05,620
was its idea.

92
00:06:05,660 --> 00:06:06,620
Wonderful.

93
00:06:06,620 --> 00:06:13,550
Let's now open up Mongo shell and let's try to create new database the inside of this container.

94
00:06:14,090 --> 00:06:21,480
But before doing that let's no list files and folders inside of the DB folder in Mongo folder here.

95
00:06:21,730 --> 00:06:22,930
Unless Debian.

96
00:06:23,690 --> 00:06:30,570
And now I see that there are a bunch of new files that were created by who by Mongo container.

97
00:06:30,590 --> 00:06:34,280
That is know Iranian before start of this container.

98
00:06:34,280 --> 00:06:39,620
This Debbie folder was empty and now it is full of new files.

99
00:06:39,620 --> 00:06:41,030
That is a great sign.

100
00:06:41,030 --> 00:06:41,600
Great.

101
00:06:41,630 --> 00:06:47,720
Let's now open up a mongo shell and let's create additional database and let's add one or two records

102
00:06:47,750 --> 00:06:48,890
inside of the new collection.

103
00:06:48,890 --> 00:06:50,510
Same as we did before.

104
00:06:50,510 --> 00:06:51,970
Let me clear a terminal and here.

105
00:06:51,970 --> 00:06:54,740
Let's use darkroom exec.

106
00:06:54,830 --> 00:06:56,250
This idea.

107
00:06:56,290 --> 00:07:03,040
Sorry I have forgotten to list the containers and get ideas to 6.

108
00:07:03,140 --> 00:07:03,530
OK.

109
00:07:03,790 --> 00:07:04,300
Docker.

110
00:07:04,480 --> 00:07:05,310
Exactly.

111
00:07:05,450 --> 00:07:06,810
This idea.

112
00:07:06,820 --> 00:07:08,820
2 6 and here will be at Mongo.

113
00:07:09,200 --> 00:07:14,720
Basically you are able to open up but bash shell and run Mongo down.

114
00:07:14,930 --> 00:07:16,620
Let me actually try that approach.

115
00:07:16,640 --> 00:07:17,440
Let's open up.

116
00:07:17,440 --> 00:07:23,600
Best show and here type Monaco and the result is actually the same way I connect it from mongo shell

117
00:07:23,720 --> 00:07:25,270
to mongo cetera.

118
00:07:25,310 --> 00:07:28,930
Lets know your skill command showed these.

119
00:07:29,020 --> 00:07:34,080
There are three abuse admin contact local let's create new TB use.

120
00:07:34,430 --> 00:07:38,770
Let's say my debut switched to to be my debut.

121
00:07:39,110 --> 00:07:43,010
And here instead of this my debut let's create new collection Gold.

122
00:07:43,010 --> 00:07:44,860
Let's say I don't know.

123
00:07:44,870 --> 00:07:46,550
Let's great post collection.

124
00:07:46,650 --> 00:07:57,900
Debbie posts insert and here let's insert your record into this collection and here will be a post column.

125
00:07:58,130 --> 00:07:59,020
Hey there.

126
00:07:59,810 --> 00:08:03,800
Let's insert one more record.

127
00:08:03,900 --> 00:08:06,970
How are you one more post

128
00:08:09,520 --> 00:08:10,000
doing.

129
00:08:10,180 --> 00:08:14,760
Well like so let's have a look at the contents of the posts collection.

130
00:08:14,860 --> 00:08:15,810
Debbie posts.

131
00:08:15,820 --> 00:08:18,800
Find there are three records.

132
00:08:18,800 --> 00:08:22,160
Same as in previous case with animals collection rate.

133
00:08:22,430 --> 00:08:28,940
But no those three records should be created on my local computer instead of the b folder.

134
00:08:29,810 --> 00:08:34,950
Let's go out from this Mongo shall we call exit from mongo shell.

135
00:08:35,059 --> 00:08:41,030
But we are now still located in the best shell inside of the container because we have started the best

136
00:08:41,030 --> 00:08:43,850
shell using Docker exact command and the inside of it.

137
00:08:43,850 --> 00:08:45,610
We have started Mongo shell.

138
00:08:45,680 --> 00:08:46,330
Great.

139
00:08:46,340 --> 00:08:53,720
Now let's go out from best shell type exit and notice that container will be still running because now

140
00:08:53,810 --> 00:08:56,530
Dell was running process Mongo DB Docker.

141
00:08:56,530 --> 00:09:01,070
P.S. I should see this container running and no less the following.

142
00:09:01,070 --> 00:09:07,250
Let's first have a look at contents over the D.B. folder in Mongo folder on our computer.

143
00:09:07,460 --> 00:09:14,550
Alas Debian and you'll still see some files here in this folder and you file.

144
00:09:14,550 --> 00:09:17,490
Have a look at the doors files using options.

145
00:09:17,640 --> 00:09:24,950
L.A. I will see that some of the files were changed just a few minutes ago for example this file collection

146
00:09:25,000 --> 00:09:32,360
eight or this file index that's nine basically firm up of those files is white tiger and we are not

147
00:09:32,420 --> 00:09:35,090
able to read the contents of those files directly.

148
00:09:35,390 --> 00:09:41,140
Basically we're able to trade that let's use scout command cut the beast less and less so read the index

149
00:09:41,190 --> 00:09:49,280
dash nine file for example index this 9 step and you'll see almost unreadable file but we are actually

150
00:09:49,280 --> 00:09:52,670
able to extract some words from it.

151
00:09:52,670 --> 00:09:56,680
Basically let me have a look also at the file for example.

152
00:09:56,690 --> 00:09:58,580
This one collection Dash 8.

153
00:09:58,760 --> 00:09:59,550
Let me use again.

154
00:09:59,550 --> 00:09:59,830
Cut.

155
00:09:59,830 --> 00:10:00,560
Command cut.

156
00:10:00,610 --> 00:10:03,410
Debbie slash collection.

157
00:10:03,470 --> 00:10:06,400
This aid like soul breath.

158
00:10:06,400 --> 00:10:09,220
Step and in this output.

159
00:10:09,240 --> 00:10:15,350
Yet in this output it seems that I see some text that was inserted into post collection.

160
00:10:15,360 --> 00:10:17,470
How are you or doing well.

161
00:10:17,520 --> 00:10:18,360
And so on.

162
00:10:18,360 --> 00:10:24,840
It means that those records were created in the database located on my computer and that is a really

163
00:10:24,840 --> 00:10:25,790
good sign.

164
00:10:25,890 --> 00:10:27,550
No list right to the following.

165
00:10:27,570 --> 00:10:33,750
Let's try to remove contain the longer container that discount uranium and create new container using

166
00:10:33,750 --> 00:10:38,940
the same command using persistent volume weapon grade with the clear terminal here.

167
00:10:39,180 --> 00:10:40,930
Let's stop running container.

168
00:10:40,990 --> 00:10:42,640
DOCTOR Yes.

169
00:10:42,920 --> 00:10:44,850
Doctor stop.

170
00:10:45,030 --> 00:10:49,480
2 6 Doctor our m 2 6.

171
00:10:49,500 --> 00:10:57,130
I'll remove it as well and don't drop in all containers and let's no use same command in order to start

172
00:10:57,190 --> 00:10:59,310
over new Mongo container.

173
00:10:59,440 --> 00:10:59,950
Well it's clear.

174
00:10:59,950 --> 00:11:00,930
Terminal end.

175
00:11:01,420 --> 00:11:05,050
Let me go through history and find this command somewhere here.

176
00:11:06,320 --> 00:11:08,760
Yeah here it is Doc around there's D.

177
00:11:09,190 --> 00:11:11,790
Well you might be in this V and the here.

178
00:11:11,830 --> 00:11:16,840
Let's map same TB folder today that TB inside of the new Mongo container.

179
00:11:16,840 --> 00:11:23,590
Again it will be brand new container without any relation to previous container left breast cancer.

180
00:11:23,590 --> 00:11:25,420
Here was a D of New container.

181
00:11:25,420 --> 00:11:26,340
Dr. Pierce.

182
00:11:27,280 --> 00:11:30,790
Let's open up a best shell to this new container Docker.

183
00:11:30,800 --> 00:11:31,550
Exactly.

184
00:11:31,570 --> 00:11:36,340
This a team C D and the here will be on mongo.

185
00:11:36,400 --> 00:11:40,860
Let's start directly Mongo process and here as before.

186
00:11:40,860 --> 00:11:46,400
Let's list the abuse show debuts and I'll see my DB here on the list.

187
00:11:46,440 --> 00:11:48,480
Let's switch to my BBM.

188
00:11:48,480 --> 00:11:54,180
Use my debut and let's find some records in the post collection.

189
00:11:54,270 --> 00:12:02,900
D.B. not both find like so and I'll see those three poles that were created before the game.

190
00:12:02,910 --> 00:12:09,840
Now we were able to connect to the same database that was used in the previous container and by previous

191
00:12:09,840 --> 00:12:10,680
container.

192
00:12:10,680 --> 00:12:16,470
We can edit the records to that database and that is a really really important conclusion.

193
00:12:16,590 --> 00:12:24,000
We are able to use same database by different containers and the such approach is used very often either

194
00:12:24,000 --> 00:12:26,230
in development or in production.

195
00:12:26,250 --> 00:12:29,390
Different containers connect to the same database.

196
00:12:29,550 --> 00:12:30,300
Wonderful.

197
00:12:30,370 --> 00:12:36,380
That's all for this lecture and let me actually go out from this Mongo shell and destroy current Iranian

198
00:12:36,420 --> 00:12:37,050
container.

199
00:12:37,050 --> 00:12:40,790
I don't need it anymore Docker is Docker.

200
00:12:40,950 --> 00:12:47,070
Stop Cydia and docker r m Cydia and we are all set.

201
00:12:47,070 --> 00:12:53,430
At the moment we know how to create a system database for example using Mongo image you are able to

202
00:12:53,430 --> 00:12:59,020
use any other databases with the same approach and that's all for this lotion and nice list proceed

203
00:12:59,100 --> 00:13:00,120
and the next list.

204
00:13:00,120 --> 00:13:04,990
Try for example WordPress image and lounge WordPress container.

205
00:13:05,070 --> 00:13:06,020
I'll see you next.

206
00:13:06,030 --> 00:13:06,380
Bye bye.

