1 00:00:00,000 --> 00:00:04,200 [Intro Music] 2 00:00:04,230 --> 00:00:06,210 We have just successfully created 3 00:00:06,240 --> 00:00:08,279 phpMyAdmin with additional 4 00:00:08,279 --> 00:00:09,825 environment variable called 5 00:00:09,825 --> 00:00:12,390 PMA_HOST, and in that 6 00:00:12,390 --> 00:00:14,550 variable, we have set IP address of 7 00:00:14,550 --> 00:00:17,490 the MySQL server. And finally, you 8 00:00:17,490 --> 00:00:18,930 have seen that we were able to 9 00:00:18,930 --> 00:00:22,421 connect to MySQL database using phpMyAdmin. 10 00:00:22,421 --> 00:00:24,120 And again, main idea here 11 00:00:24,150 --> 00:00:26,880 is that we are running phpMyAdmin 12 00:00:26,910 --> 00:00:29,340 and MySQL on two different 13 00:00:29,340 --> 00:00:31,950 containers. Please notice that 14 00:00:31,950 --> 00:00:33,900 such approach is exactly the same 15 00:00:34,050 --> 00:00:36,030 for other containers that you want 16 00:00:36,060 --> 00:00:39,360 to connect together. Now, let me get 17 00:00:39,360 --> 00:00:42,450 back to two busybox containers, and 18 00:00:42,480 --> 00:00:44,880 explain you concept of the custom 19 00:00:44,880 --> 00:00:46,860 networks and explain you how you're 20 00:00:46,860 --> 00:00:48,150 able to communicate between 21 00:00:48,150 --> 00:00:50,400 containers using their names 22 00:00:50,430 --> 00:00:52,800 instead of IP addresses. But before 23 00:00:52,800 --> 00:00:55,140 doing that, let me quickly take 24 00:00:55,140 --> 00:00:56,970 notes of the commands that we have 25 00:00:56,970 --> 00:01:00,354 used here for start of the phpMyAdmin, 26 00:01:00,354 --> 00:01:02,700 this command; and MySQL 27 00:01:02,700 --> 00:01:04,890 container command, this one. And for 28 00:01:04,890 --> 00:01:06,599 that, let me go to Visual Studio 29 00:01:06,599 --> 00:01:09,570 Code, here and let me minify this 30 00:01:09,570 --> 00:01:11,430 folder, and let's create a new 31 00:01:11,430 --> 00:01:14,730 folder called 'mysql' here near those 32 00:01:14,730 --> 00:01:16,830 folders. Let's click on New Folder 33 00:01:16,830 --> 00:01:19,560 icon and here will be 'mysql' like 34 00:01:19,560 --> 00:01:21,840 so. And here inside of this folder, 35 00:01:21,870 --> 00:01:24,210 let me create a new file called 36 00:01:24,270 --> 00:01:28,140 'commands.txt'. And here, let me 37 00:01:28,170 --> 00:01:30,420 have a note of those commands that 38 00:01:30,420 --> 00:01:32,820 we have used for start of the 'mysql' 39 00:01:32,820 --> 00:01:34,740 container. Let me copy this 40 00:01:34,740 --> 00:01:37,410 command. Copy, and go to Visual 41 00:01:37,410 --> 00:01:39,360 Studio Code, and here, let me add a 42 00:01:39,360 --> 00:01:43,710 comment, 'START MYSQL SERVER WITH 43 00:01:43,740 --> 00:01:48,420 CUSTOM ROOT PASSWORD'. Let me hide 44 00:01:48,450 --> 00:01:50,760 this pane. And here let me 45 00:01:50,760 --> 00:01:52,830 paste this command. And next 46 00:01:52,860 --> 00:01:58,830 let me type, 'START PHPMYADMIN WITH 47 00:01:59,250 --> 00:02:03,840 PMA_HOST VARIABLE', and let me copy 48 00:02:04,500 --> 00:02:08,310 this command from here, like so, 49 00:02:08,729 --> 00:02:11,430 and paste here. Great. Here we have 50 00:02:11,460 --> 00:02:13,740 two commands on the list. And with 51 00:02:13,740 --> 00:02:15,420 this commands we're able to start up 52 00:02:15,420 --> 00:02:17,160 the MySQL server. And with this 53 00:02:17,160 --> 00:02:19,665 command, we're able to start phpMyAdmin 54 00:02:19,665 --> 00:02:21,390 But basically for better 55 00:02:21,390 --> 00:02:23,460 readability let me split those 56 00:02:23,460 --> 00:02:25,740 commands into multiple lines, and 57 00:02:25,740 --> 00:02:27,720 for that I could use here backslash, '\' 58 00:02:27,750 --> 00:02:30,270 like so. Here, I could use tab if 59 00:02:30,270 --> 00:02:32,820 you want. And here let's also add 60 00:02:32,820 --> 00:02:35,010 backslash, '\'; and add the newline like 61 00:02:35,010 --> 00:02:37,080 so. Again, there was no difference 62 00:02:37,470 --> 00:02:39,030 in previous command and in such 63 00:02:39,030 --> 00:02:40,710 command because backslash '\' is 64 00:02:40,710 --> 00:02:43,500 actually just a splitter for large 65 00:02:43,500 --> 00:02:46,020 command. And here let's also split 66 00:02:46,050 --> 00:02:50,550 this command, like so. Next, split 67 00:02:50,550 --> 00:02:53,820 this command as well. And let's add 68 00:02:53,820 --> 00:02:55,800 backslash, '\' here, and create this 69 00:02:55,800 --> 00:02:57,810 command like so. Great. Now those 70 00:02:57,810 --> 00:02:59,640 commands are more readable. And 71 00:02:59,640 --> 00:03:01,500 here actually, let me add the 72 00:03:01,530 --> 00:03:05,790 comment, '(over IP address)', because 73 00:03:05,790 --> 00:03:07,860 here we have connected to MySQL 74 00:03:07,860 --> 00:03:10,560 Server using its IP address. And 75 00:03:10,560 --> 00:03:12,030 again, that is not the best 76 00:03:12,030 --> 00:03:13,440 approach because IP addresses are 77 00:03:13,440 --> 00:03:15,630 usually dynamic, they may change. 78 00:03:15,690 --> 00:03:17,430 And that's why it is much better to 79 00:03:17,430 --> 00:03:19,470 use hostnames for connection 80 00:03:19,470 --> 00:03:21,150 between different servers. It is a 81 00:03:21,150 --> 00:03:22,890 general approach. Great. Let me 82 00:03:22,890 --> 00:03:24,810 save the file and go back to 83 00:03:24,810 --> 00:03:27,630 terminal. Now let me stop those 84 00:03:27,630 --> 00:03:30,420 containers, stop this one, and 85 00:03:30,450 --> 00:03:33,750 actually stop mysql as well. 'CTRL+ 86 00:03:33,750 --> 00:03:36,450 C'. It seems it doesn't accept the 87 00:03:36,450 --> 00:03:38,730 CTRL+C key combination, probably Q. 88 00:03:39,240 --> 00:03:41,250 Also doesn't work. All right. Let 89 00:03:41,250 --> 00:03:45,420 me then go to 'docker ps'. 'docker ps', 90 00:03:45,660 --> 00:03:48,270 and here use 'docker kill', and here 91 00:03:48,270 --> 00:03:50,580 will be ID of the mysql container, 92 00:03:50,760 --> 00:03:52,560 and let's prune all containers, 93 00:03:52,620 --> 00:03:58,140 'docker container prune'. 'Y'. All 94 00:03:58,140 --> 00:04:00,360 right. Let's now proceed. And next 95 00:04:00,390 --> 00:04:02,610 let's get back to two busybox 96 00:04:02,640 --> 00:04:04,800 containers. And let me explain you 97 00:04:04,830 --> 00:04:06,720 how you're able to communicate over 98 00:04:06,720 --> 00:04:08,670 hostnames instead of IP addresses. 99 00:04:08,880 --> 00:04:10,813 I'll see you in the next lecture. Bye-Bye. 100 00:04:10,813 --> 00:04:13,500 [no audio]