1
00:00:01,585 --> 00:00:03,469
Now we already learned

2
00:00:03,469 --> 00:00:06,080
and saw that containers are great

3
00:00:06,080 --> 00:00:09,450
and that they can make development easier.

4
00:00:09,450 --> 00:00:13,240
And thus far we only focused on development.

5
00:00:13,240 --> 00:00:18,240
However, containers are these independent isolated packages

6
00:00:19,210 --> 00:00:23,050
full of application code and application environment

7
00:00:23,050 --> 00:00:26,480
which we can ship anywhere where Docker runs.

8
00:00:26,480 --> 00:00:28,300
Because they are standardized

9
00:00:28,300 --> 00:00:29,760
if we built them with Docker

10
00:00:29,760 --> 00:00:32,390
and therefore Docker can run them anywhere

11
00:00:32,390 --> 00:00:34,083
where Docker is installed.

12
00:00:34,940 --> 00:00:37,580
And therefore, in section one of this course

13
00:00:37,580 --> 00:00:40,510
already I mentioned that containers

14
00:00:40,510 --> 00:00:43,650
can help us with problems we might be facing

15
00:00:43,650 --> 00:00:45,660
when shipping applications

16
00:00:45,660 --> 00:00:47,540
because without containers

17
00:00:47,540 --> 00:00:50,540
we often end up with different development

18
00:00:50,540 --> 00:00:52,490
and production environments

19
00:00:52,490 --> 00:00:55,160
which means that code which might work locally

20
00:00:55,160 --> 00:00:58,330
on our machine all of a sudden fails

21
00:00:58,330 --> 00:01:00,450
once we deployed the application

22
00:01:00,450 --> 00:01:03,810
onto a remote host, onto a server.

23
00:01:03,810 --> 00:01:07,210
And the idea for also already mentioned in section one

24
00:01:07,210 --> 00:01:10,940
that Docker and containers can help us with that.

25
00:01:10,940 --> 00:01:13,780
We can get the exact same environment

26
00:01:13,780 --> 00:01:15,890
on our development machine

27
00:01:15,890 --> 00:01:18,930
as we later have it on our remote machine

28
00:01:18,930 --> 00:01:21,660
where we wanna run the application

29
00:01:21,660 --> 00:01:24,440
and that is the case because the environment

30
00:01:24,440 --> 00:01:26,510
is inside of the container.

31
00:01:26,510 --> 00:01:29,100
We don't have to configure the machine itself.

32
00:01:29,100 --> 00:01:30,780
We don't have to install tools

33
00:01:30,780 --> 00:01:32,890
like Node.js on the machine,

34
00:01:32,890 --> 00:01:35,230
neither on our local development

35
00:01:35,230 --> 00:01:38,150
nor on the production remote hosting machine.

36
00:01:38,150 --> 00:01:42,000
Instead, we have everything our application needs

37
00:01:42,000 --> 00:01:43,840
inside of the container.

38
00:01:43,840 --> 00:01:46,950
So therefore, with containers and Docker

39
00:01:46,950 --> 00:01:51,040
we benefit from this isolated standalone environment

40
00:01:51,040 --> 00:01:52,690
both during development

41
00:01:52,690 --> 00:01:55,810
which we saw in all the sections up to this point,

42
00:01:55,810 --> 00:01:58,370
as well as in production.

43
00:01:58,370 --> 00:02:01,380
And that is why I had so many sections

44
00:02:01,380 --> 00:02:04,140
on our local development environment

45
00:02:04,140 --> 00:02:06,560
because everything you'll learn there

46
00:02:06,560 --> 00:02:08,539
will also help you in production

47
00:02:08,539 --> 00:02:11,140
because you ship the same containers

48
00:02:11,140 --> 00:02:14,380
you worked on locally on your local host machine

49
00:02:14,380 --> 00:02:17,990
to remote machines that should run your containers.

50
00:02:17,990 --> 00:02:20,940
And that is what we're going to see in this module

51
00:02:20,940 --> 00:02:23,580
because with these containers and with Docker

52
00:02:23,580 --> 00:02:26,290
we got these reproducible environments

53
00:02:26,290 --> 00:02:28,140
which are easy to share and use

54
00:02:28,140 --> 00:02:31,390
and that will help us for moving our application

55
00:02:31,390 --> 00:02:33,510
from our local host machine

56
00:02:33,510 --> 00:02:36,160
where it is inside of an image in the end

57
00:02:36,160 --> 00:02:39,950
to a remote machine where it's then should be served

58
00:02:39,950 --> 00:02:42,920
to all our application users.

59
00:02:42,920 --> 00:02:47,240
And therefore, we ensure when using Docker and containers

60
00:02:47,240 --> 00:02:51,140
that we don't face any unwanted surprises.

61
00:02:51,140 --> 00:02:54,700
What works on our local machine in a container

62
00:02:54,700 --> 00:02:59,390
will also work after deployment on a remote machine.

63
00:02:59,390 --> 00:03:01,380
That's the idea behind Docker.

64
00:03:01,380 --> 00:03:02,880
That's what I mentioned

65
00:03:02,880 --> 00:03:04,740
multiple times throughout this course

66
00:03:04,740 --> 00:03:08,490
and what we already used locally on our local machine

67
00:03:08,490 --> 00:03:11,090
when we learned about all these Docker basics

68
00:03:11,090 --> 00:03:13,810
and that's also what we're going to use now

69
00:03:13,810 --> 00:03:15,760
when we deploy the application

70
00:03:15,760 --> 00:03:17,810
and therefore move our container

71
00:03:17,810 --> 00:03:21,610
from the localhost machine to our remote host.

72
00:03:21,610 --> 00:03:23,400
So to some other computer

73
00:03:23,400 --> 00:03:25,410
running somewhere in the cloud,

74
00:03:25,410 --> 00:03:28,980
in the internet not on our local machine.

75
00:03:28,980 --> 00:03:30,100
Now in this module,

76
00:03:30,100 --> 00:03:33,400
we are going to dive into deploying containers.

77
00:03:33,400 --> 00:03:36,690
Which means bringing them to remote machines.

78
00:03:36,690 --> 00:03:40,600
And there are a couple of things you should be aware of

79
00:03:40,600 --> 00:03:42,810
when it comes to deploying containers.

80
00:03:42,810 --> 00:03:45,090
A couple of things you should watch out for

81
00:03:45,090 --> 00:03:47,120
and a couple of things you will see

82
00:03:47,120 --> 00:03:48,973
throughout this module therefore.

83
00:03:49,830 --> 00:03:53,410
One of the most important things which can be strange

84
00:03:53,410 --> 00:03:57,390
when you first see it is that during development

85
00:03:57,390 --> 00:03:59,570
we use bind mounts a lot.

86
00:03:59,570 --> 00:04:03,360
In production we shouldn't really use them.

87
00:04:03,360 --> 00:04:05,570
You shouldn't really use bind mounts

88
00:04:05,570 --> 00:04:07,440
when you move your container

89
00:04:07,440 --> 00:04:10,050
from your local machine to production.

90
00:04:10,050 --> 00:04:13,900
And I will come back to why that's the case in a second.

91
00:04:13,900 --> 00:04:16,339
Another important thing to watch out for

92
00:04:16,339 --> 00:04:18,899
is that your containerized apps

93
00:04:18,899 --> 00:04:22,610
might need different setups for development

94
00:04:22,610 --> 00:04:24,440
and for production

95
00:04:24,440 --> 00:04:26,560
which sounds strange at first

96
00:04:26,560 --> 00:04:29,340
after all the idea with containers

97
00:04:29,340 --> 00:04:32,560
was that we have one at the same environment.

98
00:04:32,560 --> 00:04:34,940
That's true but some applications

99
00:04:34,940 --> 00:04:37,280
like React apps for example

100
00:04:37,280 --> 00:04:39,470
simply need a build step

101
00:04:39,470 --> 00:04:42,570
where the code is converted and optimized

102
00:04:42,570 --> 00:04:45,850
and that builds step happens after development

103
00:04:45,850 --> 00:04:49,010
before you deploy the application.

104
00:04:49,010 --> 00:04:52,670
But even though we need this build step in this module

105
00:04:52,670 --> 00:04:55,490
you will all learn how you can still ensure

106
00:04:55,490 --> 00:04:57,090
that you ship containers

107
00:04:57,090 --> 00:04:59,760
which have reproducible environments

108
00:04:59,760 --> 00:05:02,320
and where to code that work locally

109
00:05:02,320 --> 00:05:05,450
will also work once you deployed it.

110
00:05:05,450 --> 00:05:08,420
The same by the way will be true for bind mounts

111
00:05:08,420 --> 00:05:11,500
even though we may use them during development

112
00:05:11,500 --> 00:05:13,750
and we shouldn't use them in production.

113
00:05:13,750 --> 00:05:16,280
You will still learn in this section

114
00:05:16,280 --> 00:05:20,830
how does won't contradict the idea behind containers

115
00:05:20,830 --> 00:05:24,650
and how does won't lead to containers that are different

116
00:05:24,650 --> 00:05:27,110
during development and production.

117
00:05:27,110 --> 00:05:29,360
You will see how that all still works

118
00:05:29,360 --> 00:05:32,370
even though we might have differences.

119
00:05:32,370 --> 00:05:34,490
In addition one other thing we'll see

120
00:05:34,490 --> 00:05:35,730
throughout this module

121
00:05:35,730 --> 00:05:39,410
is related to multi-container projects.

122
00:05:39,410 --> 00:05:43,440
In such projects it heavily depends on the project

123
00:05:43,440 --> 00:05:47,140
and on the containers whether you might need to

124
00:05:47,140 --> 00:05:50,950
or maybe might want to split your containers

125
00:05:50,950 --> 00:05:52,790
across multiple hosts

126
00:05:52,790 --> 00:05:56,050
so across multiple remote machines.

127
00:05:56,050 --> 00:05:58,900
So whilst you might be able to test everything

128
00:05:58,900 --> 00:06:03,170
let's say with Docker compose locally on one host machine

129
00:06:03,170 --> 00:06:06,190
for deployment you might consider splitting it

130
00:06:06,190 --> 00:06:09,670
across multiple servers or multiple host machines

131
00:06:09,670 --> 00:06:11,743
and I will come back that as well.

132
00:06:12,890 --> 00:06:14,300
And last but not least,

133
00:06:14,300 --> 00:06:16,020
throughout this module,

134
00:06:16,020 --> 00:06:19,540
there will be a couple of points, a couple of lectures

135
00:06:19,540 --> 00:06:22,490
where we actually make a trade off

136
00:06:22,490 --> 00:06:25,530
and where we may be go for a solution

137
00:06:25,530 --> 00:06:29,750
where we have less control over the deployment platform.

138
00:06:29,750 --> 00:06:32,440
For example, over a remote host

139
00:06:32,440 --> 00:06:36,440
but we also therefore have less responsibility

140
00:06:36,440 --> 00:06:38,420
and that might be worth it

141
00:06:38,420 --> 00:06:41,210
as you will see throughout this module.

142
00:06:41,210 --> 00:06:42,980
Because it turns out that

143
00:06:42,980 --> 00:06:46,410
if you have to manage a remote host on your own.

144
00:06:46,410 --> 00:06:49,830
If you have to set everything up on some remote machine

145
00:06:49,830 --> 00:06:52,820
that also brings a lot of responsibility.

146
00:06:52,820 --> 00:06:55,840
Where you have to ensure that that machine is secure

147
00:06:55,840 --> 00:06:56,720
and so on.

148
00:06:56,720 --> 00:06:59,870
And therefore will have a couple of lectures in this module

149
00:06:59,870 --> 00:07:03,400
where we will actually go for less control

150
00:07:03,400 --> 00:07:06,260
but also less responsibilities solution

151
00:07:06,260 --> 00:07:10,423
so that ultimately we as a developer have an easier time.

