docker compose watch syncs files without a bind mount
Bind mounts on macOS are slow, and they pull the host's node_modules into the container. watch copies your changes in, and can rebuild when the files that need it change.
services:
web:
build: .
develop:
watch:
- action: sync
path: ./src
target: /app/src
- action: rebuild
path: package.jsonRun docker compose watch instead of up. Edits land in a fraction of a second, and the container keeps its own dependencies.
dockerdeveloper-experience