title: How can I copy node_modules folder out of my docker container onto the build machine?
body: <p>I am moving an application to a new build pipeline. On CI I am not able to install node to complete the NPM install step.</p>
  <p>My idea to is to move the npm install step to a Docker image that uses Node, install the node modules and them copy the node modules back to the host so another process can package up the application.</p>
  <p>This is my Dockerfile:</p>
  <pre><code>FROM node:9
  
  # Create app directory
  RUN mkdir -p /usr/src/app
  WORKDIR /usr/src/app
  
  # Install app dependencies
  COPY ./dashboard-interface/package.json /usr/src/app/
  RUN npm install --silent --production
  
  # Bundle app src
  COPY node_modules ./dashboard-interface/node_modules #I thought this would copy the new node_modules back to the host
  </code></pre>
  <p>This runs fine and install the node modules, but when I try and copy the node_modules directory <strong>back to the host</strong> I see an error saying:</p>
  <pre><code>COPY node_modules ./dashboard-interface/node_modules
  COPY failed: stat /var/lib/docker/tmp/docker-builder718557240/node_modules: no such file or directory
  </code></pre>
  <p>So it's clear that the copy process cannot find the node_modules directory that it has just installed the node modules too.</p>