Skip to content

Instantly share code, notes, and snippets.

@djmaze
Last active May 5, 2021 09:35
Show Gist options
  • Save djmaze/4b91176e0c2d39aa656f5ffd0fe284b1 to your computer and use it in GitHub Desktop.
Save djmaze/4b91176e0c2d39aa656f5ffd0fe284b1 to your computer and use it in GitHub Desktop.
Boosting Docker performance on OSX via NFS mounts

Run the script from this post in order to set up NFS:

curl -sL https://gist.githubusercontent.com/seanhandley/7dad300420e5f8f02e7243b7651c6657/raw/fdd77fe66cf9ce893fa0175d735cbede2bb065e4/setup_native_nfs_docker_osx.sh >/tmp/setup_native_nfs_docker_osx.sh 
bash /tmp/setup_native_nfs_docker_osx.sh
rm /tmp/setup_native_nfs_docker_osx.sh

Copy the supplied docker-compose.override.yml to your project directory. Adjust the version (version), service name (app) and the app path (/usr/src/app) according to the app service definition in your existing docker-compose.yml.

The file can be put under version control.

The OSX developers can activate this configuration by creating a symlink:

ln -s docker-compose.override.osx.yml docker-compose.override.yml
# Adjust version, app service name and volume mount path according to your app
# Activate this configuration via `ln -s docker-compose.override.osx.yml docker-compose.override.yml`
version: "3.4"
services:
app:
volumes:
- nfsmount:/usr/src/app
volumes:
nfsmount:
driver: local
driver_opts:
type: nfs
o: addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3
device: ":${PWD}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment