This is my dockerfile
FROM node:15
# sets the folder structure to /app directory
WORKDIR /app
# copy package.json to /app folder
COPY package.json .
RUN npm install
# Copy all files from current directory to current directory in docker(app)
COPY . ./
EXPOSE 3000
CMD ["node","index.js"]
I am using this command in my powershell to run the image in a container
docker run -v ${pwd}:/app -p 3000:3000 -d --name node-app node-app-image
${pwd}returns the current directory. But as soon as I hit enter, somehow node_modules isn't being installed in the container and I get "express not found" error in the log. [![Docker log][1]][1] I can't verify if node_modules isn't being installed because I can't get the container up to run theexec --itcommand.
I was following a freecodecamp tutorial and it seems to work in his pc and I've tried this command in command prompt too by replacing ${pwd} by %cd%.
This used to work fine before I added the volume flag in the command. [1]: https://i.stack.imgur.com/4Fifu.png