title: Docker: reload a nodejs app with nodemon
body: <p>I have a <em>hello, world</em> express app that I run with <code>nodemon</code> so that whenever I change a file the server restarts. </p>
  
  <p>I am packaging the app as a docker image. </p>
  
  <p><strong>Dockerfile</strong>:</p>
  
  <pre><code>FROM node:6.3.0
  
  RUN mkdir -p /opt/app
  WORKDIR /opt/app
  
  COPY . /opt/app
  
  RUN npm install
  
  EXPOSE 3000
  
  CMD ["npm", "start"]
  </code></pre>
  
  <p><code>npm start</code> runs <code>nodemon -L index.js</code> as defined in <a href="https://github.com/jatins/node-docker-reload/blob/master/package.json" rel="noreferrer">package.json</a></p>
  
  <p>However, I can't build the image everytime I make a change to the my app.
  I also have a <strong>docker-compose.yml</strong> file, in which I specify the <code>build</code> option, but still I can't get the container to reload with</p>
  
  <pre><code>version: "2"
  services:
    rpro:
      build: .
      command: npm start
      ports:
        - "3000:3000"
      volumes:
        - /opt/app
  </code></pre>
  
  <p>Here the the <a href="https://github.com/jatins/node-docker-reload" rel="noreferrer">entire repo</a></p>
  
  <hr>
  
  <p><em>How do I achieve server restart on file changes with docker containers? What is the usual dev workflow in such a case?</em></p>