Open domtes opened 6 years ago
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.
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
!
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: