docker bind mount not working in react app

394 Views Asked by At

I am using docker toolbox on windows home and having trouble figuring out how to get bind mount working in my frontend app. I want changes to be reflected upon changing content in the src directory.

App structure:

enter image description here

Dockerfile:

FROM node
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
EXPOSE 3000
CMD [ "npm", "start" ]

Docker commands:

  1. (within the frontend dir) docker build -t frontend .
  2. docker run -p 3000:3000 -d -it --rm --name frontend-app -v ${cwd}:/app/src frontend

Any help is highly appreciated.

EDIT

cwd -> E:\docker\multi\frontend

cwd/src is also not working. However, i find that with /e/docker/multi/frontend/src the changes are reflected upon re running the same image

1

There are 1 best solutions below

3
user19025283 On

i have ran into same issue it feels like we should use nodemon to look for file changes and restart the app. because with docker reference and tutorials project does the thing.