title: How to use nodemon in a Docker node project?
body: <p>I'm creating a docker node application with a postgres DB. Here is my <code>Dockerfile</code>:</p>
  
  <pre><code># Use an official node runtime as a parent image
  FROM node:10
  
  # Set the working directory to /home/app
  WORKDIR /home/app/
  
  # Copy package.json to /home/app
  COPY package.json .
  
  # Bundle app source to /home/app
  COPY . .
  
  # If you are building your code for production
  # RUN npm install --only=production
  RUN npm install
  
  # Make port 8000 available to the world outside this container
  EXPOSE 8000
  
  CMD npm run dev
  </code></pre>
  
  <p>And my <code>docker-compose.yml</code> file:</p>
  
  <pre><code>version: "2"
  services:
    brewmaster: 
      build: .
      image: myUser/brew_backend:latest
      ports: 
        - 7000:8000
      depends_on:
        - postgres
      environment:
        - DATABASE_URL=postgres://postgres:password@db:5432/brewmaster
        - PORT=3000
      volumes:
        - .:/home/app/
  
    postgres:
      image: postgres
      restart: always
      ports:
        - "5432:5432"
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_PASSWORD=password
        - POSTGRES_DB=brewmaster
  </code></pre>
  
  <p>So I have sync my volumes so when I do a local change and I save, I'm able to see the change in my container. However, when I refresh my web page, I don't see the change.</p>
  
  <p>In my package.json file, I have this line to run nodemon:</p>
  
  <pre><code> "scripts": {
      "dev": "nodemon server.js"
    }
  </code></pre>
  
  <p>How can I see my changes in my navigator when I save changes in my code? Do I use nodemon correctly? (I run <code>npm run dev</code> in my Dockerfile)</p>
  
  <p>I'm using docker on Windows with hyper-V.</p>
  
  <p>EDIT</p>
  
  <p>I found the solution by putting this in my <code>package.json</code> file:</p>
  
  <pre><code>"scripts": {
      "dev": "nodemon -L --inspect=0.0.0.0:7000 server.js"
    }
  </code></pre>
  
  <p>So nodemon listening to host port 7000 and detect file changes.</p>