title: Nodemon doesn't reload in docker container when files change
body: <p>I read many threads sabout this but no one solves anything.  </p>
  
  <p>Some say you have to add <code>--legacy-watch</code> (or <code>-L</code>) to the <code>nodemon</code> command.
  Others shows several different configurations and apparently nodody really knows what you gotta do to achieve server restarting when a file change at the volume inside a docker container.  </p>
  
  <p>Here my configuration so far: </p>
  
  <p>Dockerfile:</p>
  
  <pre><code>FROM node:latest
  
  # Create app directory
  RUN mkdir -p /usr/src/app
  WORKDIR /usr/src/app
  
  # install nodemon globally
  RUN npm install nodemon -g
  
  # Install dependencies
  COPY package*.json ./
  RUN npm install
  
  # Bundle app source
  COPY . /usr/src/app
  
  # Exports
  EXPOSE 3000
  
  CMD ["npm", "start"]
  </code></pre>
  
  <p>docker-compose.yml</p>
  
  <pre><code>version: '3.1'
  
  services:
      node:
          build: .
          user: "node"
          volumes:
          - ./:/usr/src/app
          ports: 
              - 3000:3000
          depends_on: 
              - mongo
          working_dir: /usr/src/app
          environment:
          - NODE_ENV=production
          expose:
          - "3000"
      mongo:
          image: mongo
          expose:
          - 27017
          volumes:
          - ./data/db:/data/db
          environment:
              MONGO_INITDB_ROOT_USERNAME: root
              MONGO_INITDB_ROOT_PASSWORD: example
  </code></pre>
  
  <p>package.json</p>
  
  <pre><code>{
    "name": "node-playground",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
      "test": "echo \"Error: no test specified\" &amp;&amp; exit 1",
      "start": "nodemon -L"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "dependencies": {
      "ejs": "^2.7.1",
      "express": "^4.17.1",
      "mongoose": "^5.7.1"
    },
    "devDependencies": {
      "nodemon": "^1.19.2"
    }
  }
  
  </code></pre>
  
  <p>I tried many different setups as well. Like not installing globally <code>nodemon</code> but only as a project dependency. And also running the command at the <code>docker-compse.yml</code>, and i believe many others I don't remember right now. Nothing.   </p>
  
  <p>If someone has any cetainty about this, please help. Thanks!!!!</p>