adlogix / docker-machine-nfs

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

Conflicts with Vagrant nfs mounts #48

Closed sebas5384 closed 7 years ago

sebas5384 commented 8 years ago

I work on projects that uses Vagrant with Virtual Box and Docker with Docker Machine on Mac OS X.

Every time I use Vagrant, and then I switch to my projects with Docker, the docker-machine-nfs gives me an error saying it's conflicting with the current /etc/exports.

The workaround till now is:

The problem is that I'm having to do almost the same thing when have to go back to my other projects using Vagrant.

I took a look at the other issues talking about the /etc/exports usage by this command, though I didn't find any solution.

Help? :)

krasilich commented 8 years ago

Hi Sebastian! Could you please do the following:

I want to see vagrants configuration, but don't have it installed

tonivdv commented 8 years ago

Hey @sebas5384 ,

Do you know what the default ip vagrant is using? Because exports conflict can happen without vagrant too if you use multiple docker-machine boxes. The thing with docker-machine is that it doesn't lock the ip address to a box (see https://github.com/docker/machine/issues/1709). So it could be that when you start vagrant and later machine (and vice-versa) the ip changes constantly.

What I do to prevent this is following work around (https://github.com/docker/machine/issues/1709#issuecomment-161026484).

Try this and let us know.

That being all said, the management of the /etc/export in docker-machine-nfs is very basic, so it can be improved to avoid such things. But for for our (Adlogix/Adsdaq) needs it's not high priority.

Cheers

sebas5384 commented 8 years ago

@krasilich and @tonivdv thanks your quick response!!

@krasilich here's my /etc/exports file when I have my vagrant's projects running.

$ cat /etc/exports
# VAGRANT-BEGIN: 501 6991d57f-1e23-42a1-a13a-d14d18659ec0
"/Users/sebas/Virtual/projects/myprojectwithvagrant" 192.168.22.11 -alldirs -mapall=501:20
# VAGRANT-END: 501 6991d57f-1e23-42a1-a13a-d14d18659ec0

@tonivdv I'll try to do that and I'll let you know.

Again thanks.

sebas5384 commented 8 years ago

I tried to create a new machine with different CIDR, "192.168.98.1/24" instead of "192.168.22.1/24" like my vagrant's projects do:

$ docker-machine create -d virtualbox --virtualbox-hostonly-cidr "192.168.98.1/24" default98
$ docker-machine start default98
(default98) Starting VM...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.

$ eval "$(docker-machine env default98)"
$ docker-machine-nfs default98
[INFO] Configuration:

  - Machine Name: default98
  - Shared Folder: /Users
  - Force: false

[INFO] machine presence ...       OK
[INFO] machine running ...      OK
[INFO] Lookup mandatory properties ...    OK

  - Machine IP: 192.168.98.100
  - Network ID: vboxnet8
  - NFSHost IP: 192.168.98.1

[INFO] Configure NFS ...

 !!! Sudo will be necessary for editing /etc/exports !!!
Password:
exports:5: /Users conflicts with existing export /Users/sebas/Virtual/projects/myprojectwithvagrant
exports:6: /Users conflicts with existing export /Users/sebas/Virtual/projects/myprojectwithvagrant

but still same error, maybe I'm doing something wrong :/

tonivdv commented 8 years ago

Hey @sebas5384 ,

I could be wrong but it could be related to the fact that one machine tries to share /Users/sebas/Virtual/... and the other /Users only. I would have to test this to confirm.

sebas5384 commented 8 years ago

@tonivdv yep! that was the problem :(

So now I just comment the Vagrant mount whenever I want to use the docker-machine with nfs.

I can't figure it out which project should deal with this, but I feel like Vagrant isn't removing the Vagrant mount when the virtual machine is down. That could resolve this issue, ... I think.

Thanks for the help!

robrecord commented 6 years ago

It's Local that should be using a more specific path, their path overlaps everything.