1
00:00:02,340 --> 00:00:04,960
So that's it for this module.

2
00:00:04,960 --> 00:00:08,230
Again, another large module with a lot of content

3
00:00:08,230 --> 00:00:10,320
and a lot of explanations in it,

4
00:00:10,320 --> 00:00:12,910
but we had a look at a couple of key concepts

5
00:00:12,910 --> 00:00:16,140
which you have to know when you're working with Docker.

6
00:00:16,140 --> 00:00:19,040
We learned that containers can read and write data

7
00:00:19,040 --> 00:00:22,070
but that volumes can help us with storing data

8
00:00:22,070 --> 00:00:26,180
especially with data that should survive container removal.

9
00:00:26,180 --> 00:00:28,530
We also had a look at bind mounts

10
00:00:28,530 --> 00:00:31,950
which can help us with direct container interaction.

11
00:00:31,950 --> 00:00:33,930
For example, with our source code,

12
00:00:33,930 --> 00:00:38,250
that should be updatable by us and where the latest source

13
00:00:38,250 --> 00:00:40,300
code should then always be available

14
00:00:40,300 --> 00:00:41,950
inside of the container.

15
00:00:41,950 --> 00:00:45,050
But let's go through what we learned step-by-step.

16
00:00:45,050 --> 00:00:47,630
Containers are the heart of Docker

17
00:00:47,630 --> 00:00:51,140
and they can already read and write data.

18
00:00:51,140 --> 00:00:53,950
They do add this read-write layer

19
00:00:53,950 --> 00:00:56,410
on top of your image after all

20
00:00:57,570 --> 00:01:01,050
but data, which you write inside of a container is lost

21
00:01:01,050 --> 00:01:02,870
if that container is removed.

22
00:01:02,870 --> 00:01:05,560
Because of that isolation concept

23
00:01:05,560 --> 00:01:08,810
often that's useful but sometimes it's not.

24
00:01:08,810 --> 00:01:12,440
Pretty much every application has some kind of data

25
00:01:12,440 --> 00:01:15,930
which should survive, which should persist.

26
00:01:15,930 --> 00:01:18,300
And that's why you can add volumes.

27
00:01:18,300 --> 00:01:21,560
Volumes in the end are folders on your host machine

28
00:01:21,560 --> 00:01:23,360
on which your containers are running,

29
00:01:23,360 --> 00:01:24,950
which are managed by Docker

30
00:01:24,950 --> 00:01:28,450
and which are mounted into a Docker container.

31
00:01:28,450 --> 00:01:30,130
There is this connection

32
00:01:30,130 --> 00:01:34,180
between the paths which are mapped inside of a container

33
00:01:34,180 --> 00:01:38,180
and the automatically created folder on your host machine.

34
00:01:38,180 --> 00:01:41,180
And whatever is written into that mapped path

35
00:01:41,180 --> 00:01:42,430
inside of the container,

36
00:01:42,430 --> 00:01:45,710
is also stored on the host machine therefore,

37
00:01:45,710 --> 00:01:49,970
and hence this data survives if the container is removed,

38
00:01:49,970 --> 00:01:53,170
because it's basically mirrored or copied

39
00:01:53,170 --> 00:01:54,560
to the host machine

40
00:01:54,560 --> 00:01:58,203
and not just stored inside off the container.

41
00:01:59,400 --> 00:02:02,860
Now specifically, we learned about two kinds of volumes.

42
00:02:02,860 --> 00:02:06,580
Named volumes are useful because of these survive

43
00:02:06,580 --> 00:02:08,120
if a container is removed

44
00:02:08,120 --> 00:02:10,720
and they offer, these are the volumes we need

45
00:02:10,720 --> 00:02:13,420
if we wanna store data permanently.

46
00:02:13,420 --> 00:02:17,300
Anonymous volumes are actually attached to a container

47
00:02:17,300 --> 00:02:19,970
and are removed if the container are removed

48
00:02:19,970 --> 00:02:23,530
and therefore they're not useful for storing permanent data,

49
00:02:23,530 --> 00:02:25,660
which should persist.

50
00:02:25,660 --> 00:02:29,660
They can still be useful to save temporary data

51
00:02:29,660 --> 00:02:32,570
make D container a bit more efficient

52
00:02:32,570 --> 00:02:35,760
because less data has to be stored in the container.

53
00:02:35,760 --> 00:02:39,490
More data can be outsourced to the host system.

54
00:02:39,490 --> 00:02:44,100
And we also saw that they can help us with bind mounts

55
00:02:44,100 --> 00:02:47,910
because bind mounts allow us to map local folders

56
00:02:47,910 --> 00:02:51,200
on the host machine, which we, as a developer know

57
00:02:51,200 --> 00:02:53,800
two internal folders into container

58
00:02:53,800 --> 00:02:57,990
for example, to expose our source code to the container.

59
00:02:57,990 --> 00:03:01,170
And then we can combine that with anonymous volumes

60
00:03:01,170 --> 00:03:05,550
to not accidentally override folders that already existed

61
00:03:05,550 --> 00:03:08,113
in the container, which we don't wanna override.

62
00:03:09,290 --> 00:03:11,630
Bind mounts are a bit like named volumes

63
00:03:11,630 --> 00:03:13,860
but the key differences that we know

64
00:03:13,860 --> 00:03:17,380
the path on the host machine, where the data is mirrored,

65
00:03:17,380 --> 00:03:20,890
and that we actually use that path to pass data

66
00:03:20,890 --> 00:03:23,690
into the container and to actually pass data

67
00:03:23,690 --> 00:03:26,980
into the container which we can change on the host machine.

68
00:03:26,980 --> 00:03:29,870
And where then the latest data is always available

69
00:03:29,870 --> 00:03:30,800
in the container.

70
00:03:30,800 --> 00:03:33,420
Like we did it with our source code.

71
00:03:33,420 --> 00:03:37,370
Now you can set up these volumes on the Docker run command

72
00:03:37,370 --> 00:03:39,400
with the -v option.

73
00:03:39,400 --> 00:03:41,930
Here we have a named volume

74
00:03:41,930 --> 00:03:45,000
and Docker automatically creates these volumes for you.

75
00:03:45,000 --> 00:03:47,430
If they don't exist yet, if they do exist

76
00:03:47,430 --> 00:03:49,810
it uses the existing ones instead.

77
00:03:49,810 --> 00:03:53,570
Here, we set up a bind mount by mapping an absolute path

78
00:03:53,570 --> 00:03:57,310
on our local machine to an internal path into container.

79
00:03:57,310 --> 00:03:59,520
And here we set up an anonymous volume.

80
00:03:59,520 --> 00:04:02,300
Here we do the same to simply make sure

81
00:04:02,300 --> 00:04:05,250
that certain folders inside of the container

82
00:04:05,250 --> 00:04:09,020
are not overridden by the bind mount in this case.

83
00:04:09,020 --> 00:04:10,140
And last but not least,

84
00:04:10,140 --> 00:04:12,290
we also had a look at build arguments

85
00:04:12,290 --> 00:04:14,360
and runtime environment variables

86
00:04:14,360 --> 00:04:16,399
which simply can make our images

87
00:04:16,399 --> 00:04:19,649
and containers a bit more dynamic and configurable

88
00:04:19,649 --> 00:04:22,890
since we can pass in certain pieces of data

89
00:04:22,890 --> 00:04:25,250
from outside when we built the image

90
00:04:25,250 --> 00:04:27,280
or when we ran the container.

91
00:04:27,280 --> 00:04:29,920
And we don't have to hard code everything

92
00:04:29,920 --> 00:04:33,130
into the Docker file or into our source code.

93
00:04:33,130 --> 00:04:36,040
Instead, we can configure this when we run the container

94
00:04:36,040 --> 00:04:38,550
and that can be useful as well.

95
00:04:38,550 --> 00:04:40,770
And that's what we learned in this module

96
00:04:40,770 --> 00:04:44,290
as always definitely feel free to go back

97
00:04:44,290 --> 00:04:46,650
to certain lectures and go through them again.

98
00:04:46,650 --> 00:04:50,010
If certain concepts should not be entirely clear by now

99
00:04:50,010 --> 00:04:51,410
in the next module,

100
00:04:51,410 --> 00:04:54,120
we're going to dive even deeper into Docker.

101
00:04:54,120 --> 00:04:56,080
And we're also going to explore

102
00:04:56,080 --> 00:04:58,700
how we can actually use multiple containers

103
00:04:58,700 --> 00:05:02,090
running different applications, and how we can ensure

104
00:05:02,090 --> 00:05:05,220
that these containers can then work together.

105
00:05:05,220 --> 00:05:07,400
Also quite interesting this year

106
00:05:07,400 --> 00:05:10,850
is an important of foundation, which we need for debt.

107
00:05:10,850 --> 00:05:13,273
So make sure we're all on the same page.

