I am running Docker with Docker Machine on Mac. I successfully set up some containers and ran npm install inside them, as explained here. This installs the node_modules inside the image and inside the container, but they are not available on the host, i.e. my IDE complains about missing node_modules.
Am I missing something? What is the best way to run npm install inside the container but be able to do development (with these dependencies) on the host?
From my docker-compose.yml:
volumes:
- /Users/andre/IdeaProjects/app:/home/app
- /home/app/node_modules
Since you are using boot2docker, only Max host folder /Users/
is mounted and accessible from the boot2docker host.
That means you would need to map /home/app/node_modules
to a Mac host path starting with /Users
, to see said modules on your Mac host.
volumes:
- /Users/andre/IdeaProjects/app:/home/app
- /Users/andre/node_modules:/home/app/node_modules