Can we add dockerignore and ignore node_modules, beacuse there are some OS specific packages that won't work for docker container, so that we don't have to use volumes for node_modules? Amazing video BTW
Hey there! Completely forgot about adding dockerignore to this... However I had to make a node_modules volume as I created a volume that brings the entire server code (package.json, node_modules, src, and all) into the container. Because of this I don't think placing node_modules in dockerignore would prevent it from being copied over but I could be wrong... I think .dockerignore is only for copying code over with COPY and not volumes?
Nice vid. Would adding node_modules to a .dockerignore file cover the problem with installing the incorrect binaries? Inside the Dockerfile, when specifying `RUN npm install`, would it not then install the correct modules for the given container (20-Alpine)? And therefore remove the need for a node_modules volume? Thanks
Hey there thanks! It wouldn't in this case as the volume I made is copying the entire application into the container. The dockerignore file is for ignoring things at build time! Volumes are applied at runtime so it would overwrite the node_modules created in the build step.
Thank you for the tutorial. However, I prefer not to dockerize my Node application or install MongoDB on my system. Could you guide me on how to access MongoDB from Docker with my Node application, similar to how I would with MongoDB Atlas?
Hey there thanks! I don't have Mongo installed on my system as I'm using Docker like in the video. If you have Node installed locally and you want to connect just connect your Node app to the port you have mapped from your machine to the Mongo Docker container.
great video, thanks!
Can we add dockerignore and ignore node_modules, beacuse there are some OS specific packages that won't work for docker container, so that we don't have to use volumes for node_modules? Amazing video BTW
Hey there! Completely forgot about adding dockerignore to this... However I had to make a node_modules volume as I created a volume that brings the entire server code (package.json, node_modules, src, and all) into the container. Because of this I don't think placing node_modules in dockerignore would prevent it from being copied over but I could be wrong... I think .dockerignore is only for copying code over with COPY and not volumes?
Nice vid. Would adding node_modules to a .dockerignore file cover the problem with installing the incorrect binaries? Inside the Dockerfile, when specifying `RUN npm install`, would it not then install the correct modules for the given container (20-Alpine)? And therefore remove the need for a node_modules volume? Thanks
Hey there thanks! It wouldn't in this case as the volume I made is copying the entire application into the container. The dockerignore file is for ignoring things at build time! Volumes are applied at runtime so it would overwrite the node_modules created in the build step.
This a very helpful video many thanks! I did the same but got the error "MongoDB connection error: MongoServerError: Authentication failed."
No worries thanks for watching! Did you check your environment variables for the Mongo image? They set the Mongo auth!
Thank you for the tutorial. However, I prefer not to dockerize my Node application or install MongoDB on my system. Could you guide me on how to access MongoDB from Docker with my Node application, similar to how I would with MongoDB Atlas?
Hey there thanks! I don't have Mongo installed on my system as I'm using Docker like in the video. If you have Node installed locally and you want to connect just connect your Node app to the port you have mapped from your machine to the Mongo Docker container.
Why mongodb ? why not mongoose ?
🤷