A shared-NFS bind mount makes the app very slow.
AdvancedScenarioVolumes, storage and data
Answer
Situation read → Metadata-heavy workloads (node_modules, PHP autoload) over NFS or macOS file sharing are slow.
What I'd do →
- Keep dependencies inside the container (named volume for
node_modules/vendor). - On Docker Desktop use VirtioFS and
develop.watchsync. - Tune NFS (
nfsvers=4.1,noatime, largerrsize/wsize) for servers. - Measure with
fioorstrace -c.
Why → Each stat becomes a network round trip.
Interview tip → Local volumes are almost always faster than network mounts.
More on Volumes, storage and data
A Postgres container was removed and the data is gone. How should it have been run?BeginnerBind mount or named volume for local development of a Node app?BeginnerHow do you back up a named volume?IntermediateTwo containers must share files. What are your options?BeginnerA container needs a writable temp area but the root filesystem is read-only.IntermediateMoving a database volume from one Docker host to another.Intermediate