Skip to content

Instantly share code, notes, and snippets.

@mhenrixon
Last active October 21, 2020 07:39
Show Gist options
  • Save mhenrixon/eda7219f8ba213737b784f38fe87c66a to your computer and use it in GitHub Desktop.
Save mhenrixon/eda7219f8ba213737b784f38fe87c66a to your computer and use it in GitHub Desktop.
version: '3.7'
services:
app-base: &app-base
image: docker-registry.wunder.tax/company/project-base:latest
env_file:
- .env.example
- .env
environment:
BUNDLE_GITLAB__WUNDER__TAX: ${BUNDLE_GITLAB__WUNDER__TAX}
WEBPACKER_DEV_SERVER_HOST: app-assets
networks:
- wundertax
volumes:
- nfsmount:/app
volumes:
pgdata: {}
nfsmount:
driver: local
driver_opts:
type: nfs
o: addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3
device: ":${PWD}"

NFS

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment