To use NFS, you have to do the following (note: this works on macOS Catalina onwards):
Edited your Mac's NFS exports file (which is initially empty):
sudo vim /etc/exports
Adfd the following line (to allow sharing any directories in the Home directory—under older macOS versions, this would be /Users instead):
/System/Volumes/Data -alldirs -mapall=501:20 localhost
(When saved, the file macOS might pop up a permissions prompt which you need to accept to allow Terminal access to write to this file.)
Then edit your NFS config file:
sudo nano /etc/nfs.conf
Add the following line (to tell the NFS daemon to allow connections from any port—this is required otherwise Docker's NFS connections may be blocked):
nfs.server.mount.require_resv_port = 0
Then restarted nfsd so the changes takes effect:
sudo nfsd restart
Then, to make sure my Docker Compose service could use an NFS-mounted volume, I added the following to my docker-compose.yml:
You might also have to go into Privacy
tab of Security & Privacy
preferences pane and find /sbin/nfsd
and add it to Full Disk Access
.
To start by using this file: make dev COMPOSE_FILE=docker-compose.osx.yml
That should give you blazing fast performance 👍🚀