Set Up Docker For Mac with Native NFS
Finally, a faster way to sync your development environment
Last week, Docker-For-Mac shipped with brand new native NFS support!
For those of us using Docker to manage our local development environment, this is really good news because OSX’s filesystem isn’t fast enough to make most web apps useable locally combined with Docker. That’s certainly what we’ve found with Rails, anyway.
We’ve tried a few ways around this, such as docker-sync and docker-machine but they seem clunky and error-prone.
So how do we get the ball rolling with NFS?
The solution is two-fold: a bash setup script to ensure NFS is configured correctly on your Mac, and a volume stanza inside your docker-compose YAML.
Once the setup script is run, docker-compose can bring up your app using native NFS to keep your source code in sync with the code inside the container.
That’s all folks — it’s as simple as that.
EDIT: D4M has some filesystem tuning options which achieve a great performance boost. The default option is
consistent but if you change it to
cached then you shouldn’t need NFS at all for speedup. Thanks Vanya Yani for sharing this info in the comments 🙌
Like what you see? Join us, we’re hiring. 🚀