1 00:00:00,000 --> 00:00:04,200 [Intro Music] 2 00:00:04,290 --> 00:00:06,150 Alright, let's move on. And in the 3 00:00:06,150 --> 00:00:08,460 next few lectures we will explore 4 00:00:08,490 --> 00:00:10,560 elasticsearch image. But what is 5 00:00:10,590 --> 00:00:12,900 Elasticsearch? Elasticsearch is a 6 00:00:12,930 --> 00:00:14,640 search engine that allows you 7 00:00:14,640 --> 00:00:17,280 pretty efficient and fast search 8 00:00:17,310 --> 00:00:19,590 documents and indexes. And it is 9 00:00:19,590 --> 00:00:21,600 very, very often used for real time 10 00:00:21,600 --> 00:00:23,760 searches, for searches of some 11 00:00:23,760 --> 00:00:26,880 data and so on. And now, let's plan 12 00:00:26,940 --> 00:00:28,950 what we will do in the few next 13 00:00:28,950 --> 00:00:31,710 lectures. First, we will download 14 00:00:31,710 --> 00:00:33,840 the elasticsearch image, and 15 00:00:33,840 --> 00:00:36,840 second, we will need to have some 16 00:00:36,870 --> 00:00:39,300 container from which we will 17 00:00:39,300 --> 00:00:41,400 perform commands on Elasticsearch 18 00:00:41,430 --> 00:00:44,292 server, and for that we will use 19 00:00:44,292 --> 00:00:48,240 'curl' utility. And now let me try to 20 00:00:48,240 --> 00:00:50,460 find whether we are able to use 21 00:00:50,490 --> 00:00:53,310 this 'curl' utility inside busybox 22 00:00:53,370 --> 00:00:56,280 or alpine or ubuntu containers. And 23 00:00:56,280 --> 00:00:58,140 let me try to do that now. So let 24 00:00:58,140 --> 00:01:00,450 me go to terminal, and let me create 25 00:01:00,480 --> 00:01:03,000 first busybox container, 'docker 26 00:01:03,030 --> 00:01:07,590 run -it busybox'. And here, 27 00:01:07,620 --> 00:01:11,190 let me type 'curl'; and I see error 28 00:01:11,220 --> 00:01:13,470 'curl: not found'. And that means that 29 00:01:13,500 --> 00:01:15,480 this utility that allows you to 30 00:01:15,480 --> 00:01:18,390 perform PUT, GET request is not 31 00:01:18,690 --> 00:01:21,240 shipped with busybox container by 32 00:01:21,240 --> 00:01:23,790 default. Let me try to find out 33 00:01:23,790 --> 00:01:25,920 whether it is available in alpine 34 00:01:25,920 --> 00:01:30,071 container, 'docker run -it alpine', 35 00:01:30,071 --> 00:01:33,570 let me type 'curl' here, and 36 00:01:33,570 --> 00:01:35,730 again I see error, 'curl: not 37 00:01:35,730 --> 00:01:38,430 found'. Let me exit from here. And 38 00:01:38,460 --> 00:01:40,650 let me try to run ubuntu image, 39 00:01:40,770 --> 00:01:46,260 'docker run -it ubuntu', and 40 00:01:46,260 --> 00:01:48,780 here type 'curl', and again 'command 41 00:01:48,780 --> 00:01:50,700 not found'. That means that this 42 00:01:50,700 --> 00:01:52,710 command is not shipped either with 43 00:01:52,710 --> 00:01:55,230 ubuntu or busybox, or alpine 44 00:01:55,230 --> 00:01:57,630 containers out of the box. And 45 00:01:57,660 --> 00:01:59,430 there are actually two solutions 46 00:01:59,430 --> 00:02:02,130 for such problems when there is no 47 00:02:02,130 --> 00:02:03,731 command that you need to use. 48 00:02:03,731 --> 00:02:05,820 First one, you could install 49 00:02:05,850 --> 00:02:07,710 additional package, for example, in 50 00:02:07,710 --> 00:02:09,900 this container, ubuntu container; 51 00:02:10,050 --> 00:02:12,180 and from the package use 'curl' 52 00:02:12,180 --> 00:02:14,400 command. Same you're able to do for 53 00:02:14,400 --> 00:02:17,010 busybox and alpine container. But 54 00:02:17,010 --> 00:02:19,560 there is also another way. And we 55 00:02:19,560 --> 00:02:22,800 could try to search for 'curl' image 56 00:02:22,920 --> 00:02:25,110 at Docker Hub, probably some other 57 00:02:25,110 --> 00:02:27,000 people have already created a 58 00:02:27,000 --> 00:02:29,430 small tiny container that is based 59 00:02:29,460 --> 00:02:32,580 either on busybox or alpine, and has 60 00:02:32,610 --> 00:02:35,340 already this 'curl' utility out of 61 00:02:35,340 --> 00:02:37,410 the box. Let me try to find out 62 00:02:37,410 --> 00:02:38,940 that. Let me exit from this 63 00:02:38,940 --> 00:02:41,040 container, and let me go to Docker 64 00:02:41,040 --> 00:02:44,040 Hub, and here let me type 'curl', 65 00:02:44,340 --> 00:02:47,010 press Enter, and let's check out 66 00:02:47,040 --> 00:02:49,080 those results. Basically, there are 67 00:02:49,110 --> 00:02:51,780 no official images called 'curl'. 68 00:02:51,960 --> 00:02:53,490 And you see that in all those 69 00:02:53,490 --> 00:02:55,020 results there is a prefix, and 70 00:02:55,020 --> 00:02:57,270 that means that those images were 71 00:02:57,270 --> 00:02:59,820 created by some users in Docker 72 00:02:59,820 --> 00:03:01,860 Hub. Okay, let me check this first 73 00:03:01,860 --> 00:03:05,070 result 'curlimages/curl'. How 74 00:03:05,070 --> 00:03:06,960 much downloads it has, 10 75 00:03:06,960 --> 00:03:10,440 million. Let me check quantity of 76 00:03:10,440 --> 00:03:13,560 stars, 16. Probably let me check 77 00:03:13,710 --> 00:03:16,350 this one. I see that it is Alpine- 78 00:03:16,350 --> 00:03:18,240 based image with just curl. 79 00:03:18,390 --> 00:03:20,310 Basically, our goal is to find 80 00:03:20,400 --> 00:03:22,830 really small, tiny image at 81 00:03:22,830 --> 00:03:24,780 Docker hub that will be based on 82 00:03:24,780 --> 00:03:26,700 Alpine for example, and that will 83 00:03:26,700 --> 00:03:29,400 have additionally 'curl' utility already 84 00:03:29,400 --> 00:03:31,440 installed inside of it. Let me 85 00:03:31,470 --> 00:03:34,410 verify this one, 'appropriate/curl', 86 00:03:34,680 --> 00:03:37,050 this one. Yeah, and it has 87 00:03:37,050 --> 00:03:38,730 much more pulls, more than 100 88 00:03:38,730 --> 00:03:41,190 million. Let's probably use this 89 00:03:41,190 --> 00:03:44,340 one. Let me scroll down. And here 90 00:03:44,340 --> 00:03:46,500 we are able to pull it like so. Let 91 00:03:46,500 --> 00:03:48,540 me copy this command, and let's go 92 00:03:48,540 --> 00:03:51,570 to terminal and pull it over, 'docker 93 00:03:51,570 --> 00:03:55,590 pull appropriate/curl'. I'm sure 94 00:03:55,590 --> 00:03:57,150 that it will be really small in 95 00:03:57,150 --> 00:03:59,610 size. Let's verify its size, 'docker 96 00:03:59,640 --> 00:04:04,230 images', and its size is around five 97 00:04:04,260 --> 00:04:06,780 megabytes. Here it is. All right. 98 00:04:06,990 --> 00:04:09,300 Let me now try to create a new 99 00:04:09,300 --> 00:04:11,220 container based on this image. Let 100 00:04:11,220 --> 00:04:13,320 me copy its name, clear terminal, 101 00:04:13,350 --> 00:04:17,790 'docker run -it', and name of the 102 00:04:17,790 --> 00:04:21,510 image. And it seems that 103 00:04:21,750 --> 00:04:24,660 default command is not sh or bash 104 00:04:24,660 --> 00:04:27,029 here in this image. Let me verify 105 00:04:27,029 --> 00:04:28,500 basically what is the default 106 00:04:28,500 --> 00:04:30,510 command here. 'docker history' 107 00:04:30,510 --> 00:04:33,120 command will help us here, and paste 108 00:04:33,120 --> 00:04:35,310 here name of the image, and you see 109 00:04:35,310 --> 00:04:38,302 that default command is actually 'curl', 110 00:04:38,302 --> 00:04:40,530 and we are actually able to 111 00:04:40,530 --> 00:04:43,560 run this image by supplying a 112 00:04:43,560 --> 00:04:46,170 specific URL we want to pass as 113 00:04:46,230 --> 00:04:49,290 argument to 'curl' command. Let me 114 00:04:49,290 --> 00:04:52,440 show you that. 'docker run -it 115 00:04:52,440 --> 00:04:54,420 appropriate/curl'; and here we could 116 00:04:54,420 --> 00:04:56,160 type for example 'google.com'; 117 00:04:57,690 --> 00:04:59,670 and here is response from server, 118 00:04:59,730 --> 00:05:01,620 301 Moved, moved 119 00:05:01,620 --> 00:05:04,170 permanently. And actually, I am not 120 00:05:04,170 --> 00:05:06,390 happy with such way of execution of 121 00:05:06,390 --> 00:05:08,250 'curl' commands because we will need 122 00:05:08,250 --> 00:05:09,900 to execute multiple commands in 123 00:05:09,900 --> 00:05:11,649 order to interact with Elasticsearch 124 00:05:11,649 --> 00:05:13,920 server. This way let me try 125 00:05:13,950 --> 00:05:16,410 to override the default command, that is 126 00:05:16,470 --> 00:05:18,960 'curl' for this image; and let me 127 00:05:18,990 --> 00:05:22,140 try to enter 'sh' command instead. 128 00:05:22,380 --> 00:05:25,020 Let me clear terminal, and here go 129 00:05:25,380 --> 00:05:27,810 to this command and add 'sh', that 130 00:05:27,810 --> 00:05:29,730 will override again, default 131 00:05:29,730 --> 00:05:33,330 command 'curl'. All right, I'm now 132 00:05:33,360 --> 00:05:35,880 in 'sh', let me type 'curl -- 133 00:05:35,880 --> 00:05:39,300 help'. And yes, now this command is 134 00:05:39,330 --> 00:05:41,730 available here in this image, and 135 00:05:41,730 --> 00:05:43,980 here is help that you are able to 136 00:05:43,980 --> 00:05:45,540 use in order to understand how to 137 00:05:45,540 --> 00:05:47,910 use 'curl'. There are really much 138 00:05:47,910 --> 00:05:50,010 much of different options, but we 139 00:05:50,010 --> 00:05:51,930 will not use all of them. 140 00:05:52,080 --> 00:05:53,820 Basically, let me just try to enter 141 00:05:53,820 --> 00:05:57,150 a 'curl google.com' here; and I get 142 00:05:57,150 --> 00:05:58,950 the same result. If I basically 143 00:05:58,950 --> 00:06:01,230 enter 'curl www. 144 00:06:01,260 --> 00:06:04,110 google.com', I should get another 145 00:06:04,110 --> 00:06:06,060 page and yes, I get the complete 146 00:06:06,090 --> 00:06:08,520 HTML page. Great. That's how we are 147 00:06:08,520 --> 00:06:11,040 able to use the 'curl' command 148 00:06:11,250 --> 00:06:13,890 inside of this container. And I'm 149 00:06:13,890 --> 00:06:15,540 completely happy with that. We don't 150 00:06:15,540 --> 00:06:17,790 need to install 'curl' separately 151 00:06:17,790 --> 00:06:19,830 either in alpine container or 152 00:06:19,830 --> 00:06:22,500 ubuntu container. Wonderful. Now, 153 00:06:22,530 --> 00:06:23,940 we are ready to proceed, and 154 00:06:23,940 --> 00:06:26,490 next we will create elasticsearch 155 00:06:26,490 --> 00:06:29,040 container, and another such kind 156 00:06:29,040 --> 00:06:31,290 container, and we will communicate 157 00:06:31,290 --> 00:06:33,570 with Elasticsearch server from this 158 00:06:33,570 --> 00:06:35,760 container that will be based on 159 00:06:35,790 --> 00:06:39,300 'appropriate/curl' image. And next 160 00:06:39,300 --> 00:06:40,860 comes actually challenge for you. 161 00:06:41,040 --> 00:06:42,510 You will need to perform this 162 00:06:42,510 --> 00:06:45,110 initial setup yourself. I'll see you next. 163 00:06:45,110 --> 00:06:47,189 [no audio]