Set Up Docker For Mac with Native NFS

Finally, a faster way to sync your development environment

Sean Handley
Apr 2, 2018 · 2 min read
Image for post
Image for post

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 Magic

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

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store