title: Using Nodemon with Docker is not refreshing the project when the codebase changes
body: <p>I am building a Node.JS application using Postgres as the database. I am using Docker/Docker compose for the development environment. I could dockerise my environment. However there is one issue remain which is the project is not refreshing or showing the latest changes using Nodemon. Basically it is not detecting the code changes.</p>
  <p>I have a docker-compose.yaml file with the following code.</p>
  <pre><code>version: '3.8'
  
  services:
    web:
      container_name: web-server
      build: .
      ports:
        - 4000:4000
      restart: always
  </code></pre>
  <p>This is my Dockerfile.</p>
  <pre><code>FROM node:14-alpine
  RUN apk update &amp;&amp; apk upgrade
  RUN apk add nodejs
  RUN rm -rf /var/cache/apk/*
  COPY . /
  RUN cd /; npm install;
  RUN npm install -g nodemon
  EXPOSE 4000
  CMD [&quot;npm&quot;, &quot;run&quot;, &quot;docker-dev&quot;]
  </code></pre>
  <p>This is my docker-dev script in package.json file</p>
  <pre><code>&quot;docker-dev&quot;: &quot;nodemon -L --inspect=0.0.0.0 index.js&quot;
  </code></pre>
  <p>When I spin up the environment running <code>docker-compose up -d</code> and go to the localhost:4000 on the browser, I can see my application up and running there. But when I make the changes to the code and refresh the page, the new changes are not there. It seems like Nodemon is not working. I had to remove Docker images and spin up the environment again to see the latest changes.</p>
  <p>How can I fix it?</p>