Mount binds not working

So I am new to this and wanted to practice. I created a simple node project:

Screenshot 2024-05-27 014915

I setup express and nodemon. When I run my project locally it works, if I change the code and reload it reflects.


FROM node:18.12.1-alpine


COPY package*.json ./

RUN npm install

COPY ./src ./src


CMD ["npm", "run", "dev"]


 "scripts": {
    "start": "node src/index.js",
    "dev": "nodemon --watch \"./**\" --ext \"js\" --exec \"node src/index.js\""

If I run docker run -v ./src:/src/app/ -p 8080:8080 davihlav/frontend:v1 while in frontend folder changing the code doesn’t update.

Likewise in docker-compose.yml:

version: '3'
    image: davihlav/frontend:v1
    build: ./frontend
      - "8080:8080"
      - ./frontend/src:/app/src

Running docker-compose up --build in the root folder code update doesn’t work. What am I doing wrong?

You run this in Windows with Docker Desktop or WSL?

The application or the content of the folder? If the application, it has nothing to do with the bind mount mentioned in the title.

I have Docker Desktop installed, Im running this in vscode terminal

Doesn’t matter right? If the content changes so should the application

It does matter. That’s why I ask. You can find many topics about it related to nodejs and monitoring content. Bind mount just shares the files with the container, but how the changes can be monitored and how the application can reload the source code, that’s another story.

The version of your Docker Desktop is also important, as there was a bug in a recent version that bind mounted folders were indeed not synchronized with the virtual machine of Docker Desktop.