title: Installing npm dependencies inside docker and testing from volume
body: <p>I want to use Docker to create development environments for a simple node.js project. I'd like to install my project's dependencies (they are all npm packages) inside the docker container (so they won't touch my host) and still mount my code using a volume. So, the container should be able
  to find the <code>node_modules</code> folder at the path where I mount the volume, but I should not see it from the host.</p>
  
  <p>This is my Dockerfile:</p>
  
  <pre><code>FROM node:6
  
  
  RUN mkdir /code
  COPY package.json /code/package.json
  WORKDIR /code
  
  RUN npm install
  </code></pre>
  
  <p>This is how I run it:</p>
  
  <pre><code>docker build --tag my-dev-env .
  
  docker run --rm --interactive --tty --volume $(pwd):/code my-dev-env npm test
  </code></pre>
  
  <p>And this is my package.json:</p>
  
  <pre><code>  {
      "private": true,
      "name": "my-project",
      "version": "0.0.0",
      "description": "My project",
      "scripts": {
        "test": "jasmine"
      },
      "devDependencies": {
        "jasmine": "2.4"
      },
      "license": "MIT"
    }
  </code></pre>
  
  <p>It fails because it can't find <code>jasmine</code>, so it's not really installing it:</p>
  
  <pre><code>&gt; jasmine
  
  sh: 1: jasmine: not found
  </code></pre>
  
  <p>Can what I want be accomplished with Docker? An alternative would be to install the packages globally. I also tried <code>npm install -g</code> to no avail.</p>
  
  <p>I'm on Debian with Docker version 1.12.1, build 23cf638.</p>