In the last section we made a little change to our darker file and then tried rebuilding the image.
The good news is that NPM is now clearly being included inside of our container and so it's attempting
to install dependencies.
However NPM itself very quickly throw a error message right here complaining that there is no file called
package dot Jason available now just in case you weren't around or you kind of skipped over the section
where we put together the package that Jason filed together.
That is a file inside of our project directory right here.
Its purpose is to list out all the different dependencies that are required to successfully run our
project.
So when we run npm install NPM is going to try to find this file that's going to find all the dependencies
that are listed and then it's going to try to install each of those so clearly the issue here is that
NPM is not finding that file.
So let's talk about why it is all right.
So a quick diagram.
We've looked at this one before.
We've got our container on the right hand side.
We've got the steps out of our Docker file and then down here is a little representation of the node
Alpine image that we're making use of.
So let's imagine what is going on inside of our image building process right now.
First off we specify node Alpine that downloads the Alpine image or the node image to be precise and
then the next step starts up.
And it says I'm going to go back to the previous step and get the image from there and then create a
temporary container out of it.
So as soon as run npm install starts to boot up we can imagine that we take this file system snapshot
right here and we kind of put it into this very temporary container and then we execute npm install.
Now I want got a quick question for you.
Do you see anywhere inside of this file system right here.
Do you see a package not just on file.
Well the answer is No.
There is no package dot JS on file available inside of the container.
The only files and folders that are available inside the container is exactly whatever came out of the
file system snapshot from the node image.
Remember we are only working with a segment of our hard drive inside this container.
There's this entire other rest of the hard drive kind of like not connected inside this container.
And somewhere inside the rest of the hard drive is where our package dock Chase on file is.
And that is not at all being communicated into the container.
And so what we do successfully run npm install but they're just plain is no package not just on file
available.
So the takeaway here is that when you are building an image none of the files inside of your project
director right here are available inside the container.
By default they are all 100 percent sectioned off completely segmented out.
They are not at all available and you can not assume that any of these files are available unless you
specifically allow it inside of your Docker file.
So as my guest.
That's exactly what we're going to do.
We're going to add in one line of configuration to our Docker file to make sure that both are indexed
not just file in package not just on file are available inside the container when we try to run the
NPM install command.
Let's take a quick pause right here and then we're going to add in that additional instruction in the
next section.