1
00:00:02,220 --> 00:00:04,510
So we now know what containers are,

2
00:00:04,510 --> 00:00:07,640
and that Docker helps us create these containers.

3
00:00:07,640 --> 00:00:10,470
I also already outlined some advantages.

4
00:00:10,470 --> 00:00:11,900
But still, you might wonder,

5
00:00:11,900 --> 00:00:15,660
why exactly do we need containers in software development?

6
00:00:15,660 --> 00:00:18,750
Maybe the example made sense for a picnic basket?

7
00:00:18,750 --> 00:00:20,920
And to some extent, it makes sense

8
00:00:20,920 --> 00:00:22,470
for a software development.

9
00:00:22,470 --> 00:00:25,210
But is it really that important that useful?

10
00:00:25,210 --> 00:00:28,340
Yes, it is, we should just ask ourselves

11
00:00:28,340 --> 00:00:30,410
one simple question.

12
00:00:30,410 --> 00:00:35,180
Why would we want independent standardized application

13
00:00:35,180 --> 00:00:38,530
packages in software development?

14
00:00:38,530 --> 00:00:42,300
Well, for one, one very good and typical example.

15
00:00:42,300 --> 00:00:44,650
And one of the main use cases of Docker,

16
00:00:44,650 --> 00:00:48,770
I would say, We of course, often have different development

17
00:00:48,770 --> 00:00:51,120
and production environments.

18
00:00:51,120 --> 00:00:53,210
And here's a simple example.

19
00:00:53,210 --> 00:00:56,830
Let's say you created a Node.js application.

20
00:00:56,830 --> 00:00:58,660
And you wrote some code there,

21
00:00:58,660 --> 00:01:02,370
which requires Node.js version 14.3

22
00:01:02,370 --> 00:01:03,900
to run successfully.

23
00:01:03,900 --> 00:01:06,330
And this is not some made up example.

24
00:01:06,330 --> 00:01:09,870
The example you see here is Node.js code,

25
00:01:09,870 --> 00:01:13,170
which uses a feature called top level await.

26
00:01:13,170 --> 00:01:16,080
Now you don't need to know Node.js to follow along

27
00:01:16,080 --> 00:01:18,870
with this course, for the moment, it's enough to know that

28
00:01:18,870 --> 00:01:21,280
this is a feature, which would not work

29
00:01:21,280 --> 00:01:23,730
in older versions of Node.js .

30
00:01:23,730 --> 00:01:28,370
We need Node.js 14.3 or higher to execute

31
00:01:28,370 --> 00:01:30,860
this code successfully.

32
00:01:30,860 --> 00:01:35,170
The problem is that we might have that version installed

33
00:01:35,170 --> 00:01:39,070
on our local environment, on our development environment,

34
00:01:39,070 --> 00:01:40,870
on our local machine.

35
00:01:40,870 --> 00:01:43,040
But if we then take this application,

36
00:01:43,040 --> 00:01:46,690
and we deploy it onto some remote machine onto a server,

37
00:01:46,690 --> 00:01:49,760
where it should be hosted, so that the entire world

38
00:01:49,760 --> 00:01:53,340
can reach it, then on that remote machine,

39
00:01:53,340 --> 00:01:56,850
we might have an older version of Node.js installed,

40
00:01:56,850 --> 00:02:00,820
maybe 14.1, or 12, or eight, whatever.

41
00:02:00,820 --> 00:02:03,940
And all of a sudden, the code which worked locally

42
00:02:03,940 --> 00:02:07,240
on our machine doesn't work there anymore.

43
00:02:07,240 --> 00:02:09,270
And depending on what's going wrong,

44
00:02:09,270 --> 00:02:12,230
it can take quite some time to figure out what

45
00:02:12,230 --> 00:02:13,750
the problem was.

46
00:02:13,750 --> 00:02:16,330
So having the same and with that,

47
00:02:16,330 --> 00:02:20,480
I really mean, the exact same development environment,

48
00:02:20,480 --> 00:02:23,980
as we have it in production can be worth a lot.

49
00:02:23,980 --> 00:02:25,740
And that is something where Docker

50
00:02:25,740 --> 00:02:27,390
and containers can help you,

51
00:02:27,390 --> 00:02:29,800
you can lock a specific Node version

52
00:02:29,800 --> 00:02:32,840
into your Docker container, and therefore ensure

53
00:02:32,840 --> 00:02:37,220
that your code is always executed with that exact version.

54
00:02:37,220 --> 00:02:40,650
And all of a sudden, that potential problem is gone

55
00:02:40,650 --> 00:02:42,350
and can't occur anymore.

56
00:02:42,350 --> 00:02:45,530
Because your application runs in that container,

57
00:02:45,530 --> 00:02:49,040
which brings its own Node.js version.

58
00:02:49,040 --> 00:02:50,640
So that's one example.

59
00:02:50,640 --> 00:02:53,620
Kind of related to that would be another example,

60
00:02:53,620 --> 00:02:56,350
different development environments within a team

61
00:02:56,350 --> 00:02:57,610
or a company.

62
00:02:57,610 --> 00:02:59,440
Let's say we're in a big team.

63
00:02:59,440 --> 00:03:02,040
I'm working there, and you are working there.

64
00:03:02,040 --> 00:03:04,530
And now we're working on the same project,

65
00:03:04,530 --> 00:03:08,460
for example, that same Node.js application again.

66
00:03:08,460 --> 00:03:12,070
Now because you haven't worked with Node for some time,

67
00:03:12,070 --> 00:03:14,820
or because you didn't need to update,

68
00:03:14,820 --> 00:03:18,270
you still have an older version of Node.js installed

69
00:03:18,270 --> 00:03:19,620
on your system.

70
00:03:19,620 --> 00:03:21,570
And I have the latest version.

71
00:03:21,570 --> 00:03:24,980
So I wrote this code with top level await.

72
00:03:24,980 --> 00:03:26,930
And when I share the code with you,

73
00:03:26,930 --> 00:03:28,600
it doesn't work for you.

74
00:03:28,600 --> 00:03:30,370
Now, obviously, you might say,

75
00:03:30,370 --> 00:03:32,470
updating Node.js is no problem,

76
00:03:32,470 --> 00:03:34,650
I can easily update it on my system.

77
00:03:34,650 --> 00:03:36,550
And we're on the same page again.

78
00:03:36,550 --> 00:03:39,540
Yes, but for one, it's just one example.

79
00:03:39,540 --> 00:03:42,940
There could be more complex projects with more complex

80
00:03:42,940 --> 00:03:45,560
dependencies which you need to manage and install.

81
00:03:45,560 --> 00:03:48,580
And in addition, even in that, one example,

82
00:03:48,580 --> 00:03:52,500
it's still annoying that we're not able to work on the same

83
00:03:52,500 --> 00:03:55,540
code base together, and we have some guarantee

84
00:03:55,540 --> 00:03:56,970
that it will always work.

85
00:03:56,970 --> 00:03:59,490
And that we always use the same environment.

86
00:03:59,490 --> 00:04:03,530
We want that reproducibility in software development,

87
00:04:03,530 --> 00:04:06,480
and therefore even here, if we're not deploying

88
00:04:06,480 --> 00:04:11,160
it at the moment, having that locked in environment

89
00:04:11,160 --> 00:04:14,020
with everything the code needs in the container

90
00:04:14,020 --> 00:04:16,029
can be worth a lot.

91
00:04:16,029 --> 00:04:18,820
And now last but not least, even if you're working

92
00:04:18,820 --> 00:04:22,079
on your own, then still Docker and containers

93
00:04:22,079 --> 00:04:23,700
could be very useful.

94
00:04:23,700 --> 00:04:26,280
Because if you have multiple projects on which you're

95
00:04:26,280 --> 00:04:29,800
working, then you might have clashing versions.

96
00:04:29,800 --> 00:04:33,950
Let's say one project uses Python version two still

97
00:04:33,950 --> 00:04:37,340
for whatever reason, another project uses the latest

98
00:04:37,340 --> 00:04:38,510
version of Python.

99
00:04:38,510 --> 00:04:41,580
The same maybe with Node.js or PHP

100
00:04:41,580 --> 00:04:44,290
or whatever kinds of projects.

101
00:04:44,290 --> 00:04:46,570
There you would have clashing versions,

102
00:04:46,570 --> 00:04:48,820
and that means that whenever you switch

103
00:04:48,820 --> 00:04:53,600
from project A to project B, you have to uninstalled

104
00:04:53,600 --> 00:04:56,630
the wrong version and install the right version.

105
00:04:56,630 --> 00:04:59,637
For example, if one project needs Node version 12,

106
00:04:59,637 --> 00:05:02,840
the other project needs Node version 14.

107
00:05:02,840 --> 00:05:06,610
If you switch project, you have to uninstalled version 14

108
00:05:06,610 --> 00:05:10,160
installed version 12 instead, and vice versa.

109
00:05:10,160 --> 00:05:13,440
So switching between projects becomes a big hassle,

110
00:05:13,440 --> 00:05:15,470
and is no fun at all.

111
00:05:15,470 --> 00:05:17,830
And that, again is something where Docker

112
00:05:17,830 --> 00:05:19,700
and containers can help us.

113
00:05:19,700 --> 00:05:22,690
We lock our versions into the containers,

114
00:05:22,690 --> 00:05:25,460
and every project has its own container.

115
00:05:25,460 --> 00:05:28,320
And therefore if we then switch projects,

116
00:05:28,320 --> 00:05:29,740
it'll just work like that.

117
00:05:29,740 --> 00:05:32,750
We don't need to uninstall and reinstall anything

118
00:05:32,750 --> 00:05:34,530
because it's all in the container,

119
00:05:34,530 --> 00:05:37,150
not globally on our host machine.

120
00:05:37,150 --> 00:05:40,310
And they have first switching projects becomes as easy

121
00:05:40,310 --> 00:05:42,480
as launching a different container.

122
00:05:42,480 --> 00:05:45,320
And these are all things we're going to see throughout

123
00:05:45,320 --> 00:05:46,153
this course.

124
00:05:46,153 --> 00:05:48,870
And you're going to learn everything you need to solve these

125
00:05:48,870 --> 00:05:50,930
problems throughout the course.

126
00:05:50,930 --> 00:05:53,540
And that's why we might wanna consider working

127
00:05:53,540 --> 00:05:57,253
with containers and why Docker is quite helpful tool.

