Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making experimental NFS share mount options configurable #207

Open
domtes opened this issue Jul 13, 2018 · 2 comments
Open

Making experimental NFS share mount options configurable #207

domtes opened this issue Jul 13, 2018 · 2 comments

Comments

@domtes
Copy link

domtes commented Jul 13, 2018

I used this driver flawlessly on my macOS High Sierra for setting up my development environment.
Using automatic NFS share feature is very useful.

When using local volumes for touch reloaded source files I noticed a ~20s lag between host and container. That was an issue with my system that needed me to change some mount options.

The experimental NFS support feature automatically generate a script in /var/lib/boot2docker/bootlocal.sh that starts the nfs-client and then mount the exported share.

Would you please consider making those mount options overridable? A command line option could be added to pass in overrides like the following example:

$ docker-machine create \
    --driver=xhyve \
    --xhyve-experimental-nfs-share \
    --xhyve-experimental-nfs-share-mount-options="async,noatime,actimeo=1,nolock,vers=3,udp" \
    my-machine
@nullaus
Copy link

nullaus commented Mar 27, 2019

This would be very nice. For now, I have a script that I run locally to override bootlocal.sh with my own version that has the correct options.

@mdeboer
Copy link

mdeboer commented Jun 11, 2019

This would be a welcome addition! However in 0.4.0 I noticed the bootlocal.sh is no longer written, instead the generated and hardcoded script is executed directly. In my case it fails with an exception that invalid options have been provided. I suspect this has to do with the missing vers=3 option.

However, there is a quick fix but requires a bit of manual labor. If you haven't created your machine yet, create it but don't use the NFS flags. If you have a machine, no worries, just follow the steps and we'll fix it later.

Next, add the NFS exports entry yourself (as root) - in /etc/exports, something like:

/Users <docker machine IP> -alldirs -mapall=<your username here>

You can find your docker machine IP with docker-machine ls.

Now to make the virtual machine mount the volume when started, enter your docker machine using docker-machine ssh and run sudo vi /var/lib/boot2docker/bootlocal.sh. Paste the following into that file:

#!/bin/bash
sudo mkdir -p /Users
sudo /usr/local/etc/init.d/nfs-client start
sudo mount -t nfs -o noacl,async,vers=3,udp 192.168.64.1:/Users /Users

Now make the file executable by running sudo chmod +x /var/lib/boot2docker/bootlocal.sh.

As a last step we need to make sure the docker machine configuration is correct and NFS is disabled there. Stop your machine and edit ~/.docker/machine/machines/default/config.json and set NFSShares to null and NFSShare to false.

Huge thanks to @nullaus for pointing me towards bootlocal.sh!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants