1
00:00:04,460 --> 00:00:07,730
All right, listen to examine on practice everything what we just discussed.

2
00:00:08,180 --> 00:00:09,960
Let's go to the terminal here.

3
00:00:09,980 --> 00:00:12,740
I already have four containers up and running.

4
00:00:13,370 --> 00:00:20,210
And now let's find out which network was created for those containers by Docker compose for death.

5
00:00:20,210 --> 00:00:23,840
Please type comment Docker Network LLC.

6
00:00:25,150 --> 00:00:28,970
And here you'll find social network with such name images.

7
00:00:28,990 --> 00:00:36,340
This gallery underscore default Dwyer is a bridge and heroes network ideal for this particular network.

8
00:00:37,330 --> 00:00:43,980
Let's dive deeper and inspect this particular network, daughter network, inspect.

9
00:00:44,620 --> 00:00:48,070
And next could be eyes or name of the network or network I.D..

10
00:00:48,340 --> 00:00:51,970
Let's use name of the network was posted here.

11
00:00:52,420 --> 00:00:56,200
And here are all the details about this particular network.

12
00:00:56,620 --> 00:01:02,530
Let's go to the top, and here at the top, you should find such settings as subnet.

13
00:01:02,890 --> 00:01:03,700
Here was subnet.

14
00:01:03,700 --> 00:01:10,330
In my example, network prefix is 170 222 zero zero and that is 16.

15
00:01:10,810 --> 00:01:13,840
Gateway is 170, 222 0.1.

16
00:01:14,350 --> 00:01:20,800
And this IP address is internal inside of the Docker, and this gateway is set as default gateway for

17
00:01:20,800 --> 00:01:23,110
all containers in this sub network.

18
00:01:23,740 --> 00:01:29,590
Also, if you scroll a bit down, you'll find which containers are currently attached to this network.

19
00:01:30,040 --> 00:01:34,870
And here you see first container with name image as Gallery Mongo Express one.

20
00:01:35,740 --> 00:01:39,520
You'll see which IP address was assigned to this particular container.

21
00:01:40,150 --> 00:01:43,630
There was also virtual address that was assigned of the container.

22
00:01:44,560 --> 00:01:49,540
If you scroll down, you'll find information about all the containers, for example, front and container

23
00:01:49,930 --> 00:01:52,420
and corresponding IP address of such container.

24
00:01:53,020 --> 00:01:55,420
This IP address is different from this IP address.

25
00:01:56,170 --> 00:02:01,750
Also, there was a Nas or Mac address that is different from this Mac address, and same information

26
00:02:01,750 --> 00:02:07,690
could be found regarding all the containers Mongo container and API container.

27
00:02:07,930 --> 00:02:10,120
All of them have a different IP addresses.

28
00:02:11,490 --> 00:02:18,060
And if you want a good fuel output by this keyword, for instance, using Grab Command, Adhere Pipe

29
00:02:18,060 --> 00:02:24,900
and at Grab and at such filter, and you'll find out that there are four different IP addresses assigned

30
00:02:24,900 --> 00:02:33,120
to four different containers and they belong to the same network 170 222 zero zero Slezak 16.

31
00:02:34,050 --> 00:02:36,660
Let's now look into one of the containers using Shell.

32
00:02:36,930 --> 00:02:43,590
And for instance, let's open session to the Image Gallery API container and let's use container name

33
00:02:43,590 --> 00:02:48,440
this one with me copied from here and enter Docker exec.

34
00:02:48,720 --> 00:02:51,060
This idea here was container name.

35
00:02:51,180 --> 00:02:53,580
And let's open up short shell.

36
00:02:55,120 --> 00:03:00,530
No, I'm inside of the container, and let's enter your command host name like that.

37
00:03:01,330 --> 00:03:07,600
Here I get host hostname that is actually based on container of Shahnaz for this particular API container.

38
00:03:07,900 --> 00:03:10,150
In your case, hostname will be, of course, different.

39
00:03:10,570 --> 00:03:17,320
And if I type host name this, I, I'll get actual IP address of this particular container.

40
00:03:17,530 --> 00:03:21,190
It is 172, 22 0.3, in my example.

41
00:03:21,790 --> 00:03:26,950
And now from this container, let's verify connectivity with all the containers in the same network

42
00:03:27,310 --> 00:03:29,800
and with all the computers in the outside world.

43
00:03:30,280 --> 00:03:32,630
And for that, we could utilize being a comment.

44
00:03:33,130 --> 00:03:35,020
Let's first default gateway.

45
00:03:35,200 --> 00:03:39,020
It's a US is 172, $22 0.1.

46
00:03:39,580 --> 00:03:46,270
In your case, you could use same breath as you see here on this line and add one in the last octet

47
00:03:46,270 --> 00:03:47,800
instead of three here, for instance.

48
00:03:48,310 --> 00:03:54,610
So let's pin the full gateway and they get response number to verify connectivity with outside world.

49
00:03:54,610 --> 00:03:57,820
And for example, let's be been the DNS server of Google.

50
00:03:58,120 --> 00:04:01,690
Such IP address is public IP address, and it is located in the internet.

51
00:04:02,170 --> 00:04:03,130
So let's pick it.

52
00:04:04,070 --> 00:04:05,570
And I get response as well.

53
00:04:06,380 --> 00:04:09,650
It means that internet is also reachable from the container.

54
00:04:10,370 --> 00:04:14,990
No less connectivity with all the containers in the same Docker bridge network.

55
00:04:15,620 --> 00:04:17,839
No, I'm inside of the API container.

56
00:04:18,230 --> 00:04:21,950
And that's why list why to check on activity, for instance, with Mongo container.

57
00:04:22,730 --> 00:04:26,450
And now let's say I don't buoy builders of the container.

58
00:04:27,020 --> 00:04:34,220
And in such case, I could simply use name of the container and being it by name typing and add here

59
00:04:34,250 --> 00:04:34,820
Mongo.

60
00:04:35,510 --> 00:04:37,850
And they get the response from them on the container.

61
00:04:38,600 --> 00:04:47,240
Notice how this name Mongo was resolved to IP address of the Mongo container, and it was done by internal

62
00:04:47,450 --> 00:04:48,890
Docker DNS server.

63
00:04:49,460 --> 00:04:56,030
And such mapping between this API address and this name was created there automatically after start

64
00:04:56,180 --> 00:04:58,430
of all containers by Docker compose.

65
00:04:59,240 --> 00:05:04,760
And this way, now I am able to communicate with AWS or container by its name.

66
00:05:05,480 --> 00:05:07,340
Let's reach all the other containers.

67
00:05:07,460 --> 00:05:11,780
For example, let's front end like that and they get response as well.

68
00:05:12,350 --> 00:05:17,420
And IP address of the front and container is, of course, different from the API of the Mongo container

69
00:05:17,990 --> 00:05:24,110
in the same way I could, which Mongo Express container like that, or containers are interconnected

70
00:05:24,110 --> 00:05:28,010
with each other by Sosa's names and of course, by their IP addresses.

71
00:05:28,790 --> 00:05:32,300
Also, if you want, you could reach containers by container names.

72
00:05:32,840 --> 00:05:36,800
For example, here was container name from Express Container.

73
00:05:37,340 --> 00:05:42,200
Let's try to use this name in the command and use container name.

74
00:05:42,740 --> 00:05:45,860
And they also get a response from the container.

75
00:05:46,310 --> 00:05:52,850
Simple, as did this name was also result doi PR of Mongo Express container.

76
00:05:53,810 --> 00:05:59,780
It means that you could easily utilize service names that were defined in the Docker compose file,

77
00:05:59,870 --> 00:06:02,270
for instance, Mongo or Mongo Express.

78
00:06:02,720 --> 00:06:04,730
That's what we basically did on this line.

79
00:06:05,240 --> 00:06:11,930
We set several name of the Mongo in one works plus configuration just the Mongo, because we know that

80
00:06:11,930 --> 00:06:19,130
Mongo is name of Mongo service here, and this is why Mongo Express container is able to reach this

81
00:06:19,130 --> 00:06:21,440
moniker container by its name.

82
00:06:21,890 --> 00:06:26,780
That as a result, two IP addresses of actual container running Mongo image.

83
00:06:27,350 --> 00:06:27,800
All right.

84
00:06:28,040 --> 00:06:33,110
This whole container is communicate with each other internally, and the main outcome here is that you

85
00:06:33,110 --> 00:06:39,020
could use IIS or services, names or container names in order to make connections between different

86
00:06:39,020 --> 00:06:39,710
containers.

87
00:06:39,950 --> 00:06:41,390
Built by Docker compose.

88
00:06:41,960 --> 00:06:44,060
All right, let's exit from this soft shell.

89
00:06:44,360 --> 00:06:47,780
And this actually it for network an overview for Docker compose.

90
00:06:48,320 --> 00:06:50,000
I'll see you guys after the small break.

