So… I trying start learning Docker. But I can’t sync the host and the container using volumes on change and save code (using the npm run dev). All the time I have to restart the
docker-compose up --build to the "sync" kick in, but after this any change don’t update the folder or code. My exemple code:
install Next.js typescript as base.
npx create-next-app@latest --ts
version: "3" services: node-myname: build: context: . dockerfile: DockerFile.dev ports: - "3000:3000" command: "npm run dev" restart: always volumes: - .:/usr/src/home/node/app/
FROM node:16 WORKDIR /home/node/app COPY . . RUN npm install
The recomended is using volumes insted bind…
I can’t find a workaround.
May be you need to use same path?!
volumes: - .:/home/node/app/
UPD: Checkout: https://github.com/theanurin/stackoverflow.68511005 and see INITLOG.md with steps "how to setup the project"
Answered By – Maksym Anurin
Answer Checked By – Katrina (Easybugfix Volunteer)