Docker and CI/CD · Middle · Question 17 of 75
You bind-mount the project into a Node container and the app can't find its modules. Why?
- ✓Correct answer: The mount hides
node_modulesfrom the image; use a separate volume - 2Bind mounts are read-only, so modules can't be loaded from them
- 3Node can't resolve modules from folders that are mounted from a host
Explanation
Mounting over /app replaces the image's /app/node_modules with the host folder. An extra volume on /app/node_modules, or Compose Watch sync, avoids it.