DEV Community

loading...

Discussion on: How to debug Node.js in a Docker container

Collapse
nimatrazmjo profile image
Nimatullah Razmjo

Dear Alx,

Your tutorial is great. Why did you add "/usr/src/app/node_modules" in volumes. What is the purpose of it? because "/usr/src/app" contain every thing that we need.

Collapse
alex_barashkov profile image
Alex Barashkov Author

Thank you. In you local machine in app folder you don't have node modules, so when you use mount your folder will override everything in /usr/src/app. The line you mentioned, sort of preventing overriding of node modules installed during the image build process.

Collapse
lfre profile image
Alfredo Lopez

You can do the same by adding node_modules to a .dockerignore file. 👍

Thread Thread
alex_barashkov profile image
Alex Barashkov Author

No. dockerignore works only for the process of copying file during the build of the image and has nothing to do with mount.

Forem Open with the Forem app