nodemon does not work with hot reloading in docker

  Kiến thức lập trình

I’m trying to make hot reloading in docker with an express server using nodemon to monitor the js files. The problem is that when I change something in local, it changes in the docker container but the server is not restarted(I used cat to check the file changed in the docker terminal). When I add or remove file using touch command in the docker terminal, the server restart.

The docker file:
` docker
FROM node

WORKDIR /app

COPY package*.json .

RUN npm install

COPY . .

EXPOSE 3000

CMD [“npm”, “start”]

`

build command :

docker build -t myapp .

run command :
docker run --name myapp -d -v ${pwd}:/app -p 3000:3000 myapp

I expect when I change a file in the local, the server restarts in the docker container.
I tried to use node --watch

New contributor

Khaled Ramadan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT