Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Docker volumes not work on windows

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.

like image 872
Kevin Fillet Cobos Avatar asked Oct 21 '25 23:10

Kevin Fillet Cobos


1 Answers

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$.

like image 95
scripton Avatar answered Oct 24 '25 15:10

scripton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!