title: Confusion with node_modules being ignored by .dockerignore
body: <p>Thought I'd just wanted to share this.  So I am testing creation of a docker image/container with a nodejs app usiung Dockerfile.  Everything went smoothly, until I tried to add the .dockerignore file, where I listed the following files in it, expecting that they won't get copied into the docker image:</p>
  <pre><code>node_modules 
  dockerignore 
  Dockerfile
  </code></pre>
  <p>And here is my Dockerfile:</p>
  <pre><code>FROM node:latest
  WORKDIR /app
  ADD . .
  RUN npm install
  CMD node index.js
  </code></pre>
  <p>So I trashed and rebuilt my image with the existing Dockerfile and the new .dockerignore file.  After the creation, I ran <code>docker run -it --entrypoint sh &lt;image name&gt;</code> to check if those files/folders do not appear anymore.</p>
  <p><code>Dockerfile</code> and <code>.dockerignore</code> are gone.  But <code>node_modules</code> folder is still there.</p>
  <p>Took me a while to &quot;realize&quot; that MAYBE the <code>node_modules</code> folder in the image is created by the Dockerfile's <code>npm install</code> step, not the folder copied from the host anyway.</p>
  <p>Am I right?</p>