adlogix / docker-machine-nfs

Activates NFS on docker-machine
MIT License
794 stars 104 forks source link

Added basic vmwarefusion support and shared folder aliases (adds to PR 18) #23

Closed ckortekaas closed 8 years ago

ckortekaas commented 8 years ago

Hi, I this works with the basic NAT setup that docker-machine/vmware fusion seems to use, and solves the problem of NFS + VMWare fusion for me.

Support for alternative ways of getting the mount host ip may be possible with commands via 'vmrun' (kinda like VBoxManage) but a fair big of searching didn't find the right thing for me.

Closest I got was prop_nfshost_ip=$(vmrun getGuestIPAddress $(vmrun list $1 | grep "$1.vmx")) but then I realised I need the host ip, not the guest IP.

And the above requires the user to setup a symlink to vmrun like this:

sudo ln -s "/Applications/VMware Fusion.app/Contents/Library/vmrun" /usr/local/bin/vmrun

Might partially resolve https://github.com/adlogix/docker-machine-nfs/issues/21 at least for the most common use case of NAT vmware fusion and docker-machine nfs.

Note: for some reason the bootlocal.sh sudo umount /Users never seems to actually unmount the vmware fusion default hgfs, but the more recent NFS mount overrides it anyway.

Also I had to add nfs.server.mount.require_resv_port = 0 to OSX /etc/nfs.conf otherwise I got a NFS mount error about weak credentials. This is referenced in 'another' docker-machine-nfs.sh in their code here: https://gist.github.com/olalonde/3f7512c0bd2bc8abb46d so it might be worth adding that too. That's where I got the command for getting prop_nfshost_ip, thanks @DavidStaron. Hope this saves someone some time. Here's hoping vmwarefusion has some performance benefits over virtualbox for all this effort :)

Cheers, Christiaan Kortekaas

ckortekaas commented 8 years ago

Looks like I accidentally added shared folder aliases (so the host mount location e.g. /Users/username/git/reponame doesn't have to be the same inside the VM e.g. can be instead /var/shared). And I merged in the awesome custom share PR number 18. Sorry. I should have done this as separate PRs in different branches.

I can clean this up if you like, depends how close you are to wanting all of this and how soon.

adambiggs commented 8 years ago

I can clean this up if you like, depends how close you are to wanting all of this and how soon.

I'd appreciate it!

tonivdv commented 8 years ago

Hey @ckortekaas ,

Thanks for contributing. I merged the PR 18 into master, so you will have to align this here correctly. If you can also make sure to squash your commits.

Cheers

ckortekaas commented 8 years ago

I've re-done this more cleanly in a new PR. Without the aliases this time because in the end I don't think they are worth supporting now that I understand how docker-compose talks to docker regarding CWD to a docker-machine endpoint.