React application doesn't discover changes when inside docker container

Viewed 142

I have problem with React application, which is running inside docker container. I use bind mounts to connect docker container with React project on my local machine. Unfortunatelly when I change code in project on local machine changes are not discovered by React application in container. It doesn't work for neither docker nor docker compose. Files in docker container are changed (bind mounts work, I checked this) but React application in container doesn't respond to changes.

Docker command I use:

docker run -it -p 3000:3000 -v /app/node_modules -v $(pwd):/app <IMAGE_ID>

Docker compose I use (I tried set some env variables according to documentation but still doesn't work):

  react-dev-app:
    stdin_open: true
    tty: true
    build:
      context: ./
      dockerfile: Dockerfile.dev
    environment:
      CHOKIDAR_USEPOLLING: "true"
      FAST_REFRESH: 'true'
    ports:
      - "3000:3000"
    volumes:
      - ./:/app
      - /app/node_modules

Could you find what I missed?

Best regards

0 Answers
Related