2

I have my project running in a docker container, but when I make a change it doesn't update it.

My docker-compose.yml:

volumes:
      - ./server:/ezzulp_server

My dockerfile:

FROM node:14.16.0-alpine

WORKDIR /ezzulp_server

CMD ["yarn", "dev"]

It seems that the volumes doesn't work? This works perfectly on my macbook, does anyone know how to fix this for windows?

edit: docker copy's the folder correctly but when I make a change it doesn't update it.

dejanualex
  • 3,872
  • 6
  • 22
  • 37
  • Do you see a alert window that asks you agree to share the `server` folder after docker-compose up ? – frank_lee Apr 28 '21 at 03:26
  • No, there was no alert window. – Kevin Fillet Cobos Apr 28 '21 at 08:18
  • How about checking the mount status by `docker inspect CONTAINER_NAME --format={{.Mounts}}` – frank_lee Apr 28 '21 at 08:28
  • Does this answer your question? [docker-compose on Windows volume not working](https://stackoverflow.com/questions/50959475/docker-compose-on-windows-volume-not-working) also take a look at this also https://forums.docker.com/t/volume-mounts-in-windows-does-not-work/10693/13 – dejanualex Apr 28 '21 at 08:31
  • All those awnsers don't work either, the problem is that I need to restart the container each time after I made a change. But it seems that volumes just doen't work on windows? – Kevin Fillet Cobos Apr 28 '21 at 09:25

1 Answers1

5

A bit late to the party but hope this helps out some people facing the same issue. I'm assuming that you're using WSL2. The notifications only work in Windows if the files are stored on the Linux filesystem.

Linux containers only receive file change events (“inotify events”) if the original files are stored in the Linux filesystem. For example, some web development workflows rely on inotify events for automatic reloading when files have changed.

source: https://docs.docker.com/desktop/windows/wsl/#best-practices

In order to overcome this, you can run docker inside of your Linux subsystem while hosting your source files there as well. You can then still use your Windows IDE to access the source files, e.g. by using \\wsl$.

scripton
  • 228
  • 5
  • 15