1 00:00:00,960 --> 00:00:05,900 In the last section we made a little change to our darker file and then tried rebuilding the image. 2 00:00:05,910 --> 00:00:11,130 The good news is that NPM is now clearly being included inside of our container and so it's attempting 3 00:00:11,130 --> 00:00:12,410 to install dependencies. 4 00:00:12,810 --> 00:00:19,280 However NPM itself very quickly throw a error message right here complaining that there is no file called 5 00:00:19,290 --> 00:00:25,260 package dot Jason available now just in case you weren't around or you kind of skipped over the section 6 00:00:25,470 --> 00:00:28,440 where we put together the package that Jason filed together. 7 00:00:28,440 --> 00:00:31,250 That is a file inside of our project directory right here. 8 00:00:31,260 --> 00:00:35,940 Its purpose is to list out all the different dependencies that are required to successfully run our 9 00:00:35,940 --> 00:00:37,020 project. 10 00:00:37,050 --> 00:00:42,870 So when we run npm install NPM is going to try to find this file that's going to find all the dependencies 11 00:00:42,870 --> 00:00:48,900 that are listed and then it's going to try to install each of those so clearly the issue here is that 12 00:00:48,920 --> 00:00:51,450 NPM is not finding that file. 13 00:00:51,450 --> 00:00:54,050 So let's talk about why it is all right. 14 00:00:54,070 --> 00:00:56,250 So a quick diagram. 15 00:00:56,250 --> 00:00:58,380 We've looked at this one before. 16 00:00:58,380 --> 00:01:00,010 We've got our container on the right hand side. 17 00:01:00,030 --> 00:01:05,370 We've got the steps out of our Docker file and then down here is a little representation of the node 18 00:01:05,430 --> 00:01:07,810 Alpine image that we're making use of. 19 00:01:07,830 --> 00:01:12,930 So let's imagine what is going on inside of our image building process right now. 20 00:01:12,930 --> 00:01:19,530 First off we specify node Alpine that downloads the Alpine image or the node image to be precise and 21 00:01:19,530 --> 00:01:21,120 then the next step starts up. 22 00:01:21,120 --> 00:01:25,410 And it says I'm going to go back to the previous step and get the image from there and then create a 23 00:01:25,410 --> 00:01:27,300 temporary container out of it. 24 00:01:27,300 --> 00:01:32,640 So as soon as run npm install starts to boot up we can imagine that we take this file system snapshot 25 00:01:32,640 --> 00:01:41,800 right here and we kind of put it into this very temporary container and then we execute npm install. 26 00:01:41,820 --> 00:01:43,640 Now I want got a quick question for you. 27 00:01:43,650 --> 00:01:46,650 Do you see anywhere inside of this file system right here. 28 00:01:46,650 --> 00:01:49,120 Do you see a package not just on file. 29 00:01:49,120 --> 00:01:50,380 Well the answer is No. 30 00:01:50,640 --> 00:01:55,680 There is no package dot JS on file available inside of the container. 31 00:01:55,680 --> 00:02:02,190 The only files and folders that are available inside the container is exactly whatever came out of the 32 00:02:02,220 --> 00:02:06,210 file system snapshot from the node image. 33 00:02:06,210 --> 00:02:11,920 Remember we are only working with a segment of our hard drive inside this container. 34 00:02:11,910 --> 00:02:18,310 There's this entire other rest of the hard drive kind of like not connected inside this container. 35 00:02:18,480 --> 00:02:22,950 And somewhere inside the rest of the hard drive is where our package dock Chase on file is. 36 00:02:22,950 --> 00:02:27,300 And that is not at all being communicated into the container. 37 00:02:27,300 --> 00:02:33,030 And so what we do successfully run npm install but they're just plain is no package not just on file 38 00:02:33,060 --> 00:02:33,540 available. 39 00:02:34,290 --> 00:02:39,060 So the takeaway here is that when you are building an image none of the files inside of your project 40 00:02:39,060 --> 00:02:41,660 director right here are available inside the container. 41 00:02:41,660 --> 00:02:46,630 By default they are all 100 percent sectioned off completely segmented out. 42 00:02:46,680 --> 00:02:51,870 They are not at all available and you can not assume that any of these files are available unless you 43 00:02:51,870 --> 00:02:56,010 specifically allow it inside of your Docker file. 44 00:02:56,100 --> 00:02:57,080 So as my guest. 45 00:02:57,090 --> 00:02:59,180 That's exactly what we're going to do. 46 00:02:59,250 --> 00:03:04,620 We're going to add in one line of configuration to our Docker file to make sure that both are indexed 47 00:03:04,620 --> 00:03:10,920 not just file in package not just on file are available inside the container when we try to run the 48 00:03:10,920 --> 00:03:12,810 NPM install command. 49 00:03:12,810 --> 00:03:16,560 Let's take a quick pause right here and then we're going to add in that additional instruction in the 50 00:03:16,560 --> 00:03:17,190 next section.