1 00:00:00,000 --> 00:00:04,300 [Intro Music] 2 00:00:04,350 --> 00:00:05,880 We just added two additional 3 00:00:05,880 --> 00:00:07,440 services to our 'docker-compose' 4 00:00:07,440 --> 00:00:09,540 file, namely mongo and mongo- 5 00:00:09,540 --> 00:00:12,030 express. mongo image contains 6 00:00:12,060 --> 00:00:14,700 actual MongoDB daemon with Mongo 7 00:00:14,700 --> 00:00:17,670 CLI utility; and mongo-express is 8 00:00:17,670 --> 00:00:20,130 graphical user interface for mongo; 9 00:00:20,310 --> 00:00:22,350 and mongo-express is written using 10 00:00:22,380 --> 00:00:25,890 Node.js and express module. So 11 00:00:25,950 --> 00:00:28,290 let's now go ahead and bring up all 12 00:00:28,290 --> 00:00:30,060 those services. And for that we will 13 00:00:30,060 --> 00:00:32,159 utilize as usually 'docker-compose 14 00:00:32,189 --> 00:00:34,680 up' command. Also for mongo-express 15 00:00:34,680 --> 00:00:37,110 container we expose internal port 16 00:00:37,140 --> 00:00:40,200 8081 to external port 8081 17 00:00:40,230 --> 00:00:42,330 on your computer. And that means 18 00:00:42,330 --> 00:00:43,980 that we will be able to connect to 19 00:00:43,980 --> 00:00:46,620 mongo-express application using any 20 00:00:46,620 --> 00:00:49,140 web browser using address localhost 21 00:00:49,170 --> 00:00:53,130 :8081. Also, mongo-express is 22 00:00:53,160 --> 00:00:55,980 able to connect to mongo using its 23 00:00:56,010 --> 00:00:58,380 hostname 'mongo', and corresponding 24 00:00:58,380 --> 00:01:00,180 credentials for admin user of the 25 00:01:00,180 --> 00:01:02,220 database. 'root' is username for 26 00:01:02,220 --> 00:01:04,890 such user, and password is its 27 00:01:04,890 --> 00:01:07,650 password. All right, let's now go 28 00:01:07,650 --> 00:01:10,500 ahead and bring up those services. 29 00:01:10,860 --> 00:01:12,450 Let's go to the terminal where I'm 30 00:01:12,450 --> 00:01:14,490 already running such containers as 31 00:01:14,580 --> 00:01:17,760 'api' and 'frontend'. Here they are. 32 00:01:18,240 --> 00:01:19,770 And let's simply try to enter 33 00:01:19,770 --> 00:01:22,620 command 'docker-compose up'. I will 34 00:01:22,650 --> 00:01:24,330 omit for now '-d' option that 35 00:01:24,330 --> 00:01:26,340 stands for detached because I want 36 00:01:26,340 --> 00:01:28,170 to show you actual logs that will 37 00:01:28,170 --> 00:01:30,240 be generated by mongo and mongo- 38 00:01:30,240 --> 00:01:31,920 express containers. That's why 39 00:01:31,950 --> 00:01:33,780 let's simply enter 'docker-compose 40 00:01:33,810 --> 00:01:35,760 up' like that. Let's go ahead. 41 00:01:37,350 --> 00:01:39,450 Docker starts by pulling mongo 42 00:01:39,480 --> 00:01:41,310 image from Docker Hub, it usually 43 00:01:41,340 --> 00:01:43,770 consists of multiple layers. And 44 00:01:43,770 --> 00:01:45,630 here you see that separate layers 45 00:01:45,690 --> 00:01:47,880 are downloaded separately. Let's 46 00:01:47,880 --> 00:01:50,267 wait a bit until the load process is complete. 47 00:01:51,600 --> 00:01:52,500 mongo image was 48 00:01:52,530 --> 00:01:54,420 successfully downloaded. Here I see 49 00:01:54,420 --> 00:01:56,340 status informational message about 50 00:01:56,340 --> 00:01:58,680 that. And now 'docker-compose' is 51 00:01:58,680 --> 00:02:01,170 'Pulling mongo-express'. And 52 00:02:01,170 --> 00:02:03,000 similarly it consists of multiple 53 00:02:03,000 --> 00:02:04,950 layers, and all those layers are 54 00:02:04,950 --> 00:02:06,540 downloaded, and afterwards 55 00:02:06,570 --> 00:02:09,840 extracted. mongo-express image was 56 00:02:09,840 --> 00:02:12,270 downloaded as well. And you see 57 00:02:12,270 --> 00:02:14,460 also that frontend and api 58 00:02:14,460 --> 00:02:16,260 containers are up to date, there 59 00:02:16,260 --> 00:02:18,480 is no need to recreate them. But 60 00:02:18,540 --> 00:02:20,070 it is necessary to create a new 61 00:02:20,070 --> 00:02:22,500 container for mongo. Here I see 62 00:02:22,500 --> 00:02:24,180 that a new container was created. 63 00:02:24,390 --> 00:02:26,220 And also new container for mongo- 64 00:02:26,250 --> 00:02:29,100 express was created as well. And 65 00:02:29,100 --> 00:02:31,470 afterwards, I see actual logs from 66 00:02:31,470 --> 00:02:34,020 mongo-express container. Here they 67 00:02:34,050 --> 00:02:36,420 are; and from mongo container, for 68 00:02:36,420 --> 00:02:38,460 instance, here. Let me scroll to 69 00:02:38,460 --> 00:02:40,440 the very end of this output. And 70 00:02:40,440 --> 00:02:42,120 for instance, here I see such 71 00:02:42,120 --> 00:02:44,250 message as, 'Admin Database connected'. 72 00:02:44,340 --> 00:02:46,020 That comes from mongo-express 73 00:02:46,020 --> 00:02:48,870 container. And also a bit up I 74 00:02:48,870 --> 00:02:50,280 should see 'Database connected' 75 00:02:50,280 --> 00:02:51,960 message. And yes, here it is. 76 00:02:52,050 --> 00:02:54,240 It also comes from mongo-express. 77 00:02:55,020 --> 00:02:57,210 On mongo container, I see such 78 00:02:57,210 --> 00:02:58,440 message as 'Successful 79 00:02:58,440 --> 00:03:00,720 authentication'; and that means that 80 00:03:00,720 --> 00:03:02,730 mongo-express successfully 81 00:03:02,730 --> 00:03:05,010 authenticated at mongo. 'Connection 82 00:03:05,040 --> 00:03:07,140 accepted' message also comes from 83 00:03:07,170 --> 00:03:09,510 mongo container. And it seems that 84 00:03:09,540 --> 00:03:11,670 now connectivity between mongo- 85 00:03:11,670 --> 00:03:14,430 express and mongo is established. 86 00:03:14,880 --> 00:03:17,130 And notice here that in 'client' 87 00:03:17,190 --> 00:03:20,190 section, mongo shows us IP address 88 00:03:20,220 --> 00:03:22,290 of the mongo-express container. 89 00:03:22,770 --> 00:03:24,780 That's what I told you before. All 90 00:03:24,780 --> 00:03:26,520 containers communicate with each 91 00:03:26,520 --> 00:03:28,890 other using IP addresses, and those 92 00:03:28,890 --> 00:03:31,290 IP addresses are assigned by Docker 93 00:03:31,320 --> 00:03:33,690 internally. All right, let me 94 00:03:33,690 --> 00:03:36,090 actually bring down now all those 95 00:03:36,090 --> 00:03:37,800 containers in order to avoid all 96 00:03:37,800 --> 00:03:40,290 sorts of logs here, and bring up 97 00:03:40,290 --> 00:03:42,810 them in detached mode. Let's press 98 00:03:42,810 --> 00:03:45,540 'CTRL+C' here, stopping all four 99 00:03:45,540 --> 00:03:48,660 containers. mongo-express, mongo, 100 00:03:48,690 --> 00:03:51,540 frontend and api containers were 101 00:03:51,540 --> 00:03:52,980 stopped. Now there are no 102 00:03:52,980 --> 00:03:55,110 containers running. And now let's 103 00:03:55,110 --> 00:03:57,090 bring them up again, using command 104 00:03:57,120 --> 00:04:00,194 'docker-compose up' with option '-d' 105 00:04:00,194 --> 00:04:03,240 detached. Let's do that. Now 106 00:04:03,240 --> 00:04:05,400 there is no need to pull new images 107 00:04:05,520 --> 00:04:07,980 for mongo and mongo-express because 108 00:04:07,980 --> 00:04:09,600 they are already present locally in 109 00:04:09,600 --> 00:04:11,520 Docker cache. That's why it makes 110 00:04:11,520 --> 00:04:13,890 sense only to start new containers. 111 00:04:14,010 --> 00:04:16,170 And that's what Docker does here on 112 00:04:16,170 --> 00:04:18,209 those lines, starting all four 113 00:04:18,209 --> 00:04:20,490 containers. Containers were 114 00:04:20,490 --> 00:04:22,890 started. Here they are. And now, 115 00:04:22,890 --> 00:04:24,390 let's actually explore those 116 00:04:24,390 --> 00:04:26,310 containers. And first, after the 117 00:04:26,310 --> 00:04:28,140 small pause, let me explain to you 118 00:04:28,170 --> 00:04:29,700 how to get information about 119 00:04:29,700 --> 00:04:32,220 containers using Docker Desktop 120 00:04:32,250 --> 00:04:34,620 Dashboard. This one. I'll see you 121 00:04:34,620 --> 00:04:35,993 guys just in a moment. 122 00:04:35,993 --> 00:04:38,762 [no audio]