1
00:00:04,700 --> 00:00:09,410
Let me know, explain to you how different containers communicate with each other when you bring them

2
00:00:09,410 --> 00:00:16,070
up using Docker compose instead of the Docker Compose creates new breach network.

3
00:00:16,370 --> 00:00:22,670
And we've seen logs about that region network is assigned specific range of IP addresses.

4
00:00:23,300 --> 00:00:32,000
For example, you might see such range 172 22 zero zero 16 16 is Network Maersk for this particular

5
00:00:32,000 --> 00:00:32,479
network.

6
00:00:33,140 --> 00:00:40,310
And each container that is included in the Docker compose file gets unique IP address from this range.

7
00:00:41,000 --> 00:00:46,420
For example, on my computer, containers were assigned sadjapour addresses front and container.

8
00:00:46,700 --> 00:00:50,700
Such payload was API container or got such a payload was Mongo.

9
00:00:50,750 --> 00:00:53,780
This one and Mongo expressed this one again.

10
00:00:53,780 --> 00:00:57,620
Those IP addresses are different, but they belong to the same network.

11
00:00:57,890 --> 00:01:05,180
This network, in this example also there was default gateway for each container and usually default

12
00:01:05,180 --> 00:01:05,720
gateways.

13
00:01:05,720 --> 00:01:12,470
A third was ants with one in the last octet, and it is first usable IP address in this network.

14
00:01:13,160 --> 00:01:19,760
Also, there was port mapping for several containers in Docker compose configuration file and there

15
00:01:19,760 --> 00:01:26,150
was port three thousand exposed by front and container, and it is exposed to the same port three thousand

16
00:01:26,150 --> 00:01:29,000
on the local computer where you are run Docker.

17
00:01:29,940 --> 00:01:36,240
50 50 brought is brought exposed by API container, and it is exported the same brought on local computer

18
00:01:36,240 --> 00:01:40,320
5:50pm and Mongo Express container also has exports.

19
00:01:40,320 --> 00:01:49,050
Port 80, a dual Mongo container, does not have any exposed ports, but it does not stop all the containers

20
00:01:49,290 --> 00:01:55,860
from communication with Mongo container due to the fact that all those containers internally inside

21
00:01:55,860 --> 00:02:03,120
it was a Docker belong to the same network and they could communicate with each other using their IP

22
00:02:03,120 --> 00:02:03,750
addresses.

23
00:02:04,410 --> 00:02:07,920
Other than that, instead of the Docker, there was also a DNS server.

24
00:02:08,430 --> 00:02:15,270
And instead of that DNS server, Docker creates corresponding DNS mappings for the names of the services

25
00:02:15,270 --> 00:02:21,410
defined inside of the Docker compose file to corresponding IP addresses assigned to the containers.

26
00:02:22,560 --> 00:02:30,060
And this means that, for example, front and container might reach one container, either by its name

27
00:02:30,060 --> 00:02:35,370
Mongo, that will be the result of this eBay address or directly knowing the CPRS.

28
00:02:36,330 --> 00:02:42,090
But IP addresses might be assigned differently each moment when you start Docker compose.

29
00:02:42,780 --> 00:02:49,020
But those services names front and API Munguia and Montebourg Express remain unchanged.

30
00:02:49,470 --> 00:02:55,470
This way, if you want to communicate between containers internally in this network, you could simply

31
00:02:55,470 --> 00:02:59,010
utilize services names, for example Mongo or API.

32
00:02:59,490 --> 00:03:02,700
That's what we do instead of the Mongo Express container.

33
00:03:03,090 --> 00:03:07,590
We define that there are server name of the Mongo server simply as Mongo.

34
00:03:08,250 --> 00:03:12,690
And this name will be resolved internally by internal DNS servers of the Docker.

35
00:03:13,020 --> 00:03:14,970
To this, a build was in my example.

36
00:03:15,480 --> 00:03:21,090
Also note is that on your computer or such network for all those containers might be different from

37
00:03:21,090 --> 00:03:25,260
mine, but usually range starts with one hundred seventy two.

38
00:03:25,560 --> 00:03:30,390
And those IP addresses from those ranges are considered as private data addresses.

39
00:03:30,630 --> 00:03:36,720
They are not available in the global network internet, and there is no need to record them because

40
00:03:36,720 --> 00:03:42,270
actually between those containers inside it was a Docker and old site internet connection.

41
00:03:42,660 --> 00:03:47,100
There was network address translation that is also done by Docker internally.

42
00:03:47,880 --> 00:03:51,540
And this why each of the containers has access to internet.

43
00:03:51,630 --> 00:03:57,150
If your computer where you're running Docker has access to the internet, and that's why we were able

44
00:03:57,150 --> 00:04:03,330
to download, for example, npm packages in the front of the container or download Python packages inside

45
00:04:03,330 --> 00:04:04,590
of the API container.

46
00:04:05,160 --> 00:04:11,220
This network and works instead of a Docker when you bring up multiple services simultaneously using

47
00:04:11,220 --> 00:04:16,620
Docker compose and next up to the small balls of growth, let's examine that in practice.

48
00:04:16,980 --> 00:04:18,060
I'll see you just in a bit.

