![]() We can use the RUN command to execute the command npm install. Once we have our package.json files inside the image,.We copy the package.json and package-lock.json files into our working directory /app. Before we run npm install, we need to get our package.json and package-lock.json files into our images using COPY command.This way we do not have to type out full file paths but can use relative paths based on the working directory. In the Dockerfile, we are creating a working directory, WORKDIR /app to instruct Docker to use this path as the default location for all subsequent commands.We can see it from the message when we run docker-compose.ĬOPY In our case, it's node-mongodb-docker-compose_default. It creates a network named as "working-directory_default". That's because the Docker compose takes care of creating a common network between containers. Note that unlike the docker run command, with Docker compose we don't have to define any network. ![]() We can declaratively do that in the Compose file. Basically, the Compose file maps the docker run command(s) into a file and it is so convenient as we do not have to type all the parameters to pass to the docker run command.
0 Comments
Leave a Reply. |