basecamp/docker-for-mac-nfs

Name: docker-for-mac-nfs

Owner: Basecamp

Description: NFS shares in Docker for Mac

Forked from: stephank/docker-for-mac-nfs

Created: 2017-01-13 18:35:59.0

Updated: 2017-06-07 20:10:21.0

Pushed: 2017-02-03 17:48:31.0

Homepage: null

Size: 5

Language: Shell

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

docker-for-mac-nfs

This is a hack to setup NFS for /Users in Docker for Mac, for those of us who disagree with the filesystem performance of the stock installation. It is tested on macOS Sierra with Docker for Mac 1.12.

If you're using this, you'll do so at your own risk. You'll likely need to rerun the setup on every upgrade of Docker for Mac.

Specifics

Blog post

Docker for Mac transparently runs a virtual machine, which boots from a ramdisk. The ramdisk is an Alpine Linux based system called Moby. Shares configured in the preferences are normally mounted with a custom FUSE filesystem called osxfs, which has less than stellar performance.

These scripts modify the ramdisk to setup NFS instead. The import.sh script imports the stock ramdisk. The make.sh script starts a container that modifies its contents, adding files from extra/, and running container-script.sh in a chroot shell. The contents is then dumped back to a ramdisk, ready for use.

The current setup is to add the nfs-utils package, and a custom init script to mount the share. (Simply adding an entry to /etc/fstab seems to not work.)

Setup
ere 501 is your user ID, and 20 your group ID. See the output of `id`.
rs -mapall=501:20 localhost
server.mount.require_resv_port = 0
 nfsd restart
port.sh
ke.sh
Applications/Docker.app/Contents/Resources/moby/initrd.img ~/docker-for-mac-initrd.img
/initrd.img /Applications/Docker.app/Contents/Resources/moby/initrd.img

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.