1
00:00:02,150 --> 00:00:04,900
So now we know what Docker is

2
00:00:04,900 --> 00:00:08,606
and what containers are and why we might wanna use it.

3
00:00:08,606 --> 00:00:12,180
We will learn what exactly Kubernetes is a little bit later

4
00:00:12,180 --> 00:00:13,530
in the course, by the way.

5
00:00:13,530 --> 00:00:16,309
But let's stick at the basics for now.

6
00:00:16,309 --> 00:00:18,230
Containers and Docker.

7
00:00:18,230 --> 00:00:20,640
The problems solved by Docker

8
00:00:20,640 --> 00:00:23,320
and containers makes sense hopefully

9
00:00:23,320 --> 00:00:25,580
and it makes sense that we might be looking

10
00:00:25,580 --> 00:00:28,200
for a solution like Docker and containers

11
00:00:28,200 --> 00:00:31,270
but if you've been in the software development area

12
00:00:31,270 --> 00:00:34,351
for some time, you might also think to yourselves

13
00:00:34,351 --> 00:00:37,410
why Docker and why containers?

14
00:00:37,410 --> 00:00:39,020
Isn't that a problem?

15
00:00:39,020 --> 00:00:41,810
So that reproducible environment thing,

16
00:00:41,810 --> 00:00:44,190
isn't that a problem which we can solve

17
00:00:44,190 --> 00:00:46,420
with virtual machines?

18
00:00:46,420 --> 00:00:49,255
So machines running on our machines?

19
00:00:49,255 --> 00:00:54,120
Virtual machines with virtual operating systems encapsulated

20
00:00:54,120 --> 00:00:56,530
in their own shell independent

21
00:00:56,530 --> 00:00:58,860
from our host operating system,

22
00:00:58,860 --> 00:01:00,578
isn't that a solution?

23
00:01:00,578 --> 00:01:02,670
Well, kind of.

24
00:01:02,670 --> 00:01:04,230
With virtual machines,

25
00:01:04,230 --> 00:01:07,150
we have our host operating system,

26
00:01:07,150 --> 00:01:09,990
Windows or macOS or Linux

27
00:01:09,990 --> 00:01:13,700
and then on top of that, we install the virtual machine.

28
00:01:13,700 --> 00:01:17,680
So a computer inside of our computer so to say.

29
00:01:17,680 --> 00:01:20,840
This virtual machine has its own operating system,

30
00:01:20,840 --> 00:01:22,510
the virtual operating system,

31
00:01:22,510 --> 00:01:25,150
which runs inside of that virtual machine.

32
00:01:25,150 --> 00:01:26,960
Let's say Linux.

33
00:01:26,960 --> 00:01:29,250
Then in this virtual machine,

34
00:01:29,250 --> 00:01:30,720
since it is like a computer,

35
00:01:30,720 --> 00:01:33,810
it's just virtually emulated you could say,

36
00:01:33,810 --> 00:01:35,780
but inside of that virtual machine,

37
00:01:35,780 --> 00:01:37,870
we can then install extra tools.

38
00:01:37,870 --> 00:01:40,190
We can install whatever we want in there

39
00:01:40,190 --> 00:01:42,460
because it is just another machine,

40
00:01:42,460 --> 00:01:45,544
even though it just exists virtually.

41
00:01:45,544 --> 00:01:48,020
We can install all the libraries, dependencies

42
00:01:48,020 --> 00:01:49,260
and tools which we need

43
00:01:49,260 --> 00:01:52,830
and then also, move our source code there.

44
00:01:52,830 --> 00:01:56,848
And hence, since it's an encapsulated virtual machine

45
00:01:56,848 --> 00:01:59,350
with everything our program needs

46
00:01:59,350 --> 00:02:01,168
and all the tools being installed there,

47
00:02:01,168 --> 00:02:03,880
we kind of have the same result

48
00:02:03,880 --> 00:02:06,210
as with Docker and containers.

49
00:02:06,210 --> 00:02:08,680
We have an encapsulated environment

50
00:02:08,680 --> 00:02:11,050
where everything is locked in.

51
00:02:11,050 --> 00:02:13,740
And we could then have multiple such environments

52
00:02:13,740 --> 00:02:15,079
for different projects

53
00:02:15,079 --> 00:02:19,300
or we could share our virtual machine configuration

54
00:02:19,300 --> 00:02:21,280
with a colleague to ensure

55
00:02:21,280 --> 00:02:24,190
that we're working in the same environment.

56
00:02:24,190 --> 00:02:28,758
Well, this works but there are a couple of problems.

57
00:02:28,758 --> 00:02:33,758
One of the biggest problems is the virtual operating system

58
00:02:33,840 --> 00:02:35,200
and in general,

59
00:02:35,200 --> 00:02:39,670
the overhead we have with multiple virtual machines.

60
00:02:39,670 --> 00:02:43,700
Every virtual machine is really like a standalone computer,

61
00:02:43,700 --> 00:02:47,300
a standalone machine running on top of our machine.

62
00:02:47,300 --> 00:02:50,950
And therefore, if we have multiple such machines especially,

63
00:02:50,950 --> 00:02:54,383
we have a lot of wasted space and resources

64
00:02:54,383 --> 00:02:58,740
because every time a brand new computer has

65
00:02:58,740 --> 00:03:01,190
to be set up inside of our machine

66
00:03:01,190 --> 00:03:04,490
and that, of course, eats up memory, CPU

67
00:03:04,490 --> 00:03:07,380
and of course, also space on our hard drive.

68
00:03:07,380 --> 00:03:10,500
And that really can become a problem

69
00:03:10,500 --> 00:03:14,700
if you have more and more virtual machines on your system.

70
00:03:14,700 --> 00:03:16,480
Because if you have a lot of things,

71
00:03:16,480 --> 00:03:18,240
which are always the same

72
00:03:18,240 --> 00:03:21,640
and still duplicated, especially the operating system.

73
00:03:21,640 --> 00:03:25,290
You might be using Linux in all your virtual machines

74
00:03:25,290 --> 00:03:29,420
and still it's installed separately in every machine.

75
00:03:29,420 --> 00:03:32,040
And that, of course, wastes a lot of space.

76
00:03:32,040 --> 00:03:33,480
In addition, you might have a lot

77
00:03:33,480 --> 00:03:36,280
of other tools installed in every virtual machine,

78
00:03:36,280 --> 00:03:39,530
which your application doesn't need directly

79
00:03:39,530 --> 00:03:42,900
but which still are set up as a default.

80
00:03:42,900 --> 00:03:44,949
And that can be a problem.

81
00:03:44,949 --> 00:03:46,570
So to sum it up,

82
00:03:46,570 --> 00:03:49,787
virtual machines have a couple of pros and cons.

83
00:03:49,787 --> 00:03:53,120
They do allow us to create separated environments

84
00:03:53,120 --> 00:03:56,498
and we can have environment-specific configurations in them

85
00:03:56,498 --> 00:04:01,250
and we can share and reproduce everything reliably

86
00:04:01,250 --> 00:04:05,600
but we do have this redundant duplication,

87
00:04:05,600 --> 00:04:07,430
that wasted space.

88
00:04:07,430 --> 00:04:09,040
Performance can be bad

89
00:04:09,040 --> 00:04:11,560
since we have an extra machine running on top

90
00:04:11,560 --> 00:04:13,530
of our host system

91
00:04:13,530 --> 00:04:16,300
and especially if we have multiple such machines,

92
00:04:16,300 --> 00:04:18,370
performance can really degrade.

93
00:04:18,370 --> 00:04:22,240
And in addition, even though it is reproducible

94
00:04:22,240 --> 00:04:25,420
and sharable, that also can be tricky

95
00:04:25,420 --> 00:04:28,300
because if you still have to set up that virtual machine

96
00:04:28,300 --> 00:04:30,900
on every system where you want it

97
00:04:30,900 --> 00:04:34,790
and you have to then configure it in exactly the same way.

98
00:04:34,790 --> 00:04:39,610
There is no single config file you can necessarily share.

99
00:04:39,610 --> 00:04:42,070
If you wanna deploy your application,

100
00:04:42,070 --> 00:04:44,460
so from development to production,

101
00:04:44,460 --> 00:04:45,740
you also have to ensure

102
00:04:45,740 --> 00:04:48,230
that you configure your production machine

103
00:04:48,230 --> 00:04:50,733
in the same way as your virtual machine.

104
00:04:50,733 --> 00:04:53,950
Alternatively, you run your virtual machine

105
00:04:53,950 --> 00:04:55,610
on your production machine

106
00:04:55,610 --> 00:04:57,626
but that wasted performance,

107
00:04:57,626 --> 00:05:01,580
that's something you might not wanna do in production.

108
00:05:01,580 --> 00:05:06,230
So it solves the problem but not in a perfect way.

109
00:05:06,230 --> 00:05:07,150
And you might guess

110
00:05:07,150 --> 00:05:09,880
that's why we have Docker and containers.

111
00:05:09,880 --> 00:05:12,740
And actually, it's really important to understand

112
00:05:12,740 --> 00:05:15,810
that containers is the key concept here.

113
00:05:15,810 --> 00:05:19,610
Docker is just the defacto standard tool

114
00:05:19,610 --> 00:05:22,270
for creating and managing them.

115
00:05:22,270 --> 00:05:24,390
So why does Docker help us with that?

116
00:05:24,390 --> 00:05:28,330
How do containers solve that problem in a better way

117
00:05:28,330 --> 00:05:30,630
than virtual machines do?

118
00:05:30,630 --> 00:05:34,890
With containers, we still have our host operating system,

119
00:05:34,890 --> 00:05:38,040
Windows, macOS, Linux, whatever it is

120
00:05:38,040 --> 00:05:42,300
but then we don't install a couple of machines

121
00:05:42,300 --> 00:05:43,260
in the machine.

122
00:05:43,260 --> 00:05:47,930
Instead, we utilize built-in container support,

123
00:05:47,930 --> 00:05:49,650
which our operating system has

124
00:05:49,650 --> 00:05:52,360
or emulated container support,

125
00:05:52,360 --> 00:05:56,050
something Docker will take care about that this works.

126
00:05:56,050 --> 00:06:00,140
And then we run a tool called the Docker Engine

127
00:06:00,140 --> 00:06:01,070
on top of that.

128
00:06:01,070 --> 00:06:03,540
And that will all be set up by Docker

129
00:06:03,540 --> 00:06:05,520
when we install it, by the way.

130
00:06:05,520 --> 00:06:08,840
And then, based on that Docker Engine,

131
00:06:08,840 --> 00:06:10,690
which now runs on our system,

132
00:06:10,690 --> 00:06:12,120
which is just one tool,

133
00:06:12,120 --> 00:06:15,350
one lightweight small tool being installed there,

134
00:06:15,350 --> 00:06:17,138
we can spin up containers.

135
00:06:17,138 --> 00:06:20,590
And these containers contain our code

136
00:06:20,590 --> 00:06:24,520
and the crucial tools and runtimes our code needs,

137
00:06:24,520 --> 00:06:26,930
like Node.js, for example,

138
00:06:26,930 --> 00:06:31,200
but they don't container a bloated operating system,

139
00:06:31,200 --> 00:06:34,667
tons of extra tools or anything like that.

140
00:06:34,667 --> 00:06:38,670
They might have a small operating system layer

141
00:06:38,670 --> 00:06:40,360
inside of the container

142
00:06:40,360 --> 00:06:43,650
but even that will be a very lightweight version

143
00:06:43,650 --> 00:06:45,070
of an operating system,

144
00:06:45,070 --> 00:06:47,930
much smaller than anything you would install

145
00:06:47,930 --> 00:06:49,360
in a virtual machine.

146
00:06:49,360 --> 00:06:52,760
And you're going to see how containers work exactly

147
00:06:52,760 --> 00:06:56,220
and how you create them throughout this course, of course.

148
00:06:56,220 --> 00:06:59,010
Now, the other great thing about containers

149
00:06:59,010 --> 00:07:02,130
is that you can configure and describe them

150
00:07:02,130 --> 00:07:04,090
with a configuration file

151
00:07:04,090 --> 00:07:06,660
and you can then share that file with others

152
00:07:06,660 --> 00:07:08,970
so that they can recreate the container

153
00:07:08,970 --> 00:07:11,970
or you can also build the container into something,

154
00:07:11,970 --> 00:07:13,680
which is called an image,

155
00:07:13,680 --> 00:07:15,010
which you need to do anyways

156
00:07:15,010 --> 00:07:16,940
and then you can share that image

157
00:07:16,940 --> 00:07:19,850
with others to ensure that everyone's able

158
00:07:19,850 --> 00:07:22,320
to launch that same container which you have

159
00:07:22,320 --> 00:07:25,350
on your system on their systems.

160
00:07:25,350 --> 00:07:29,990
And obviously, we're going to dive in detail into images

161
00:07:29,990 --> 00:07:32,130
and containers throughout this course,

162
00:07:32,130 --> 00:07:36,190
so you are going to learn all about that step by step.

163
00:07:36,190 --> 00:07:39,270
So if we compare containers to virtual machines,

164
00:07:39,270 --> 00:07:43,000
we have a couple of advantages on the container side.

165
00:07:43,000 --> 00:07:46,440
They have a low impact on our operating system and machine.

166
00:07:46,440 --> 00:07:47,730
They've very fast.

167
00:07:47,730 --> 00:07:50,011
And they use minimal disk space,

168
00:07:50,011 --> 00:07:53,410
sharing, rebuilding and distributing them

169
00:07:53,410 --> 00:07:55,130
is very, very easy

170
00:07:55,130 --> 00:07:56,790
because we have these images

171
00:07:56,790 --> 00:07:58,528
and these configuration files.

172
00:07:58,528 --> 00:08:02,970
And we still have encapsulated apps and environments

173
00:08:02,970 --> 00:08:06,630
with everything our app needs but nothing more,

174
00:08:06,630 --> 00:08:09,256
which is perfect, which is exactly what we want.

175
00:08:09,256 --> 00:08:11,350
Virtual machines, on the other hand,

176
00:08:11,350 --> 00:08:14,190
have that bigger impact on your operating system.

177
00:08:14,190 --> 00:08:16,140
They tend to be slower

178
00:08:16,140 --> 00:08:20,108
and they also tend to eat up more of our disk space.

179
00:08:20,108 --> 00:08:23,280
In addition, as I said, sharing, rebuilding

180
00:08:23,280 --> 00:08:26,270
and distribution, that all can be done

181
00:08:26,270 --> 00:08:31,230
but also may be trickier than with containers and Dockers.

182
00:08:31,230 --> 00:08:34,043
Still, of course, we encapsulate our environments

183
00:08:34,043 --> 00:08:37,039
but we don't just encapsulate our app

184
00:08:37,039 --> 00:08:40,309
and what it needs to run but entire computers.

185
00:08:40,309 --> 00:08:42,755
It's like having a totally separate machine,

186
00:08:42,755 --> 00:08:46,840
which in rare examples, or in rare uses cases,

187
00:08:46,840 --> 00:08:48,760
could be an advantage but often,

188
00:08:48,760 --> 00:08:53,103
it's just a bloated thing, which you don't necessarily need.

