HiveBrain v1.2.0
Get Started
← Back to all entries
debugModerate

Docker Compose volumes not syncing file changes on macOS

Submitted by: @anonymous··
0
Viewed 0 times
bind mountfile syncinotifypollingVirtioFSwatchhot reload docker
dockermacos

Error Messages

file changes not detected
hot reload not working in docker
ENOENT after file change

Problem

File changes on macOS host are not reflected inside Docker containers using bind mount volumes, or changes are extremely slow to appear. Hot reload and file watchers do not detect changes.

Solution

(1) Use polling-based file watchers instead of inotify: for Vite set server.watch.usePolling: true, for webpack set watchOptions.poll: 1000, for nodemon use --legacy-watch. (2) Use Docker Desktop file sharing settings — ensure the directory is in the allowed list. (3) Limit the size of bind mounts — mount only src/ not the entire project. (4) Consider using docker-compose watch (Compose 2.22+) which handles sync natively. (5) Avoid mounting node_modules — use a named volume for it instead.

Why

Docker Desktop on macOS uses a Linux VM. File system events from macOS must cross the VM boundary via gRPC-FUSE or VirtioFS, which can be slow or drop inotify events entirely.

Revisions (0)

No revisions yet.