adlogix / docker-machine-nfs

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

Does this work with parallels driver? #20

Closed iby closed 8 years ago

iby commented 8 years ago

Just tried using this on vm under parallels driver. It fails on me with Cannot detect the NFS mount :( and natively mounted volume is also gone now. Any tips on how to revert this without recreating the vm?

tonivdv commented 8 years ago

cc @blueimp

blueimp commented 8 years ago

Yes, this should work with the Parallels driver.

It also doesn't remove the shared folder, only unmounts /Users so it can mount it again via NFS, so restarting the VM should make use of the default shared folder again.

Could you post the output of the following command as debug info?

prlctl list --info
iby commented 8 years ago

Did that several times, didn't help. I've seen in the issues that people sometimes get it working from several attempts, so I even tried increasing the attempt count from 10 to 30. Can I mount it manually?

INFO
Name: default
Description: 
Type: VM
State: running
OS: boot2docker
Template: no
Uptime: 1 days 09:54:49 (since 2015-11-07 03:46:48)
Home: /Users/ianbytchek/.docker/machine/machines/default/default.pvm/
GuestTools: state=installed version=11.0.2-31348
Autostart: start-host
Autostop: suspend
Autocompact: off
Startup view: headless
On gui shutdown: window
On window close: keep-running
Undo disks: off
Boot order: cdrom0 hdd0 
EFI boot: off
Allow select boot device: off
External boot device: 
Remote display: mode=off address=0.0.0.0
Remote display state: stopped
Hardware:
  cpu cpus=1 VT-x accl=high mode=32
  memory 1024Mb
  video 32Mb 3d acceleration=off vertical sync=yes high resolution=no
  memory_quota auto
  hdd0 (+) sata:1 image='/Users/ianbytchek/.docker/machine/machines/default/disk.hdd' type='expanded' 20000Mb
  cdrom0 (+) sata:0 image='/Users/ianbytchek/.docker/machine/machines/default/boot2docker.iso'
  usb (+)
  net0 (+) type=shared mac=001C424621E5 card=virtio
  sound0 (+) output='Default' mixer='Default'
Host Shared Folders: (+)
  Users (+) path='/Users' mode='rw'
Host defined sharing: off
SmartMount: (-)
Encrypted: no
Edit restricted: no
Protected: no
Smart mouse optimized for games: auto
Sticky mouse: off
Keyboard optimized for games: off
Automatic sharing cameras: off
Automatic sharing bluetooth: off
Support USB 3.0: on
Faster virtual machine: off
Adaptive hypervisor: off
Disabled Windows logo: on
Auto compress virtual disks: off
Nested virtualization: on
PMU virtualization: on
Longer battery life: off
Show battery status: off
Smart mount: off
Shared profile: off
Shared cloud: off
Guest-to-host apps sharing: off
Host-to-guest apps sharing: on
Show Windows systray in Mac menu: on
Auto-switch to full screen: off
Disable aero: off
Hide minimized windows: off
Lock VM on suspend: off
Isolate VM from host: off
Smart guard: off
Smart guard: notify before creation snapshot: on
Smart guard: interval of period creating snapshots: 86400
Smart guard: maximum count of creating snapshots: 10
Time Synchronization: on
blueimp commented 8 years ago

Thanks for the output, @ianbytchek.

The shared network is available, so you should get the IP of the NFSHost with the following command:

prlsrvctl net info Shared | grep 'IPv4 address' | sed 's/.*: //'

You can then use this IP to mount the NFS share manually.

First get a shell inside the machine:

docker-machine ssh MACHINE_NAME

Then mount the NFS share from within the machine:

sudo /usr/local/etc/init.d/nfs-client start
sudo mount -t nfs -o noacl,async $NFS_HOST_IP:/Users /Users'

Replace $NFS_HOST_IP with the IP you got from the command above.

The docker-machine-nfs script works the same with VirtualBox and Parallels, the only difference is how to retrieve the IP for the NFS Host.

tonivdv commented 8 years ago

@ianbytchek have you been able to check this further?

iby commented 8 years ago

Thanks for suggestions, but no, it doesn't. The users folder seems to be present inside the vm when I ssh into it after doing docker-machine-nfs, I've tried doing the same without touching it first, then created a new machine, deleted it, ran mount, it didn't show up. Then recreated it, ran mount again, /Users still comes up empty. It should contain a pile of stuff.

ianbytchek@ibmbp:~$ docker-machine create --driver parallels tst
Running pre-create checks...
Creating machine...
Waiting for machine to be running, this may take a few minutes...
Machine is running, waiting for SSH to be available...
Detecting operating system of created instance...
Provisioning created instance...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
To see how to connect Docker to this machine, run: docker-machine env tst
ianbytchek@ibmbp:~$ docker-machine-nfs tst
[INFO] machine presence ...             OK 
[INFO] machine running ...          OK 
[INFO] Lookup mandatory properties ...      OK 

    - Machine IP: 10.211.55.50 
    - Network ID: Shared 
    - NFSHost IP: 10.211.55.2 

[INFO] Configure NFS ... 

 !!! Sudo will be necessary for editing /etc/exports !!! 
Password:
                        OK 
[INFO] Configure Docker Machine ...         OK 
[INFO] Restart Docker Machine ...       OK 
[INFO] Verify NFS mount ...             FAIL

Cannot detect the NFS mount :( 
ianbytchek@ibmbp:~$ docker-machine ssh tst
                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.9.0, build master : 16e4a2a - Tue Nov  3 19:49:22 UTC 2015
Docker version 1.9.0, build 76d6bc9
docker@tst:~$ sudo /usr/local/etc/init.d/nfs-client start
/usr/local/sbin/rpcbind is already running
999
/usr/local/sbin/rpc.statd is already running
1003
Starting nfs client utilities.
docker@tst:~$ cd /
docker@tst:/$ ls
Users/   bin/     dev/     etc/     home/    init     lib/     lib64    linuxrc  mnt/     opt/     proc/    root/    run/     sbin/    sys/     tmp      usr/     var/
docker@tst:/$ ls Users/
docker@tst:/$ sudo rm -rf Users
docker@tst:/$ ls
bin/     dev/     etc/     home/    init     lib/     lib64    linuxrc  mnt/     opt/     proc/    root/    run/     sbin/    sys/     tmp      usr/     var/
docker@tst:/$ sudo mount -t nfs -o 'noacl,async 10.211.55.2:/Users /Users'
docker@tst:/$ ls
bin/     dev/     etc/     home/    init     lib/     lib64    linuxrc  mnt/     opt/     proc/    root/    run/     sbin/    sys/     tmp      usr/     var/
docker@tst:/$ sudo mkdir Users
docker@tst:/$ sudo mount -t nfs -o 'noacl,async 10.211.55.2:/Users /Users'
docker@tst:/$ ls
Users/   bin/     dev/     etc/     home/    init     lib/     lib64    linuxrc  mnt/     opt/     proc/    root/    run/     sbin/    sys/     tmp      usr/     var/
docker@tst:/$ ls Users/
tonivdv commented 8 years ago

Hey @ianbytchek ,

Thanks for the response. I downloaded parallels trial version to try myself and it worked :s

I did exactly like you:

Machine Creation

$ docker-machine create --driver parallels tst
Running pre-create checks...
Creating machine...
(tst) OUT | Creating SSH key...
(tst) OUT | Creating Parallels Desktop VM...
(tst) OUT | Starting Parallels Desktop VM...
(tst) OUT | Waiting for VM to come online...
Waiting for machine to be running, this may take a few minutes...
Machine is running, waiting for SSH to be available...
Detecting operating system of created instance...
Detecting the provisioner...
Provisioning created instance...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
To see how to connect Docker to this machine, run: docker-machine env tst

NFS Activation

docker-machine-nfs tst       
[INFO] machine presence ...             OK 
[INFO] machine running ...          OK 
[INFO] Lookup mandatory properties ...      OK 

    - Machine IP: 10.211.55.3 
    - Network ID: Shared 
    - NFSHost IP: 10.211.55.2 

[INFO] Configure NFS ... 

 !!! Sudo will be necessary for editing /etc/exports !!! 
                        OK 
[INFO] Configure Docker Machine ...         OK 
[INFO] Restart Docker Machine ...       OK 
[INFO] Verify NFS mount ...             OK 

--------------------------------------------

 The docker-machine 'tst'
 is now mounted with NFS!

 ENJOY high speed mounts :D

--------------------------------------------

/Users folder on parallels

$ dm ssh tst
                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.8.1, build master : 7f12e95 - Thu Aug 13 03:24:56 UTC 2015
Docker version 1.8.1, build d12ea79
docker@tst:~$ ls /Users/
Guest/  Shared/ toni/
docker@tst:~$ 

So things to check:

What's your config @blueimp ?

iby commented 8 years ago

What are the odds… I'm on the latest Parallels versions that's out there. Boot2docker seems to be the only difference. Can that theoretically be the reason?

P.S. If I remember correctly, docker will complain about client versions or something like that. I've noticed your 1.8.1 image, is your docker also 1.8.1?

blueimp commented 8 years ago

I tested it with the latest versions of docker & docker-machine, so my boot2docker version is probably the same as yours, @ianbytchek.

I am using Parallels 10, not the latest Parallels 11, though I don't know if that makes any difference, especially since it worked for @tonivdv with that Parallels version.

@ianbytchek, could you try this NFS mount script with a virtualbox based docker machine? Just to rule out any issues with the NFS host itself.

tonivdv commented 8 years ago

@ianbytchek Yes my docker is also 1.8.1. I will upgrade and let you know (I have to do that in the 14 day trial period :p )

iby commented 8 years ago

@blueimp I cried happy when trashed virtuabox two weeks ago relieved that I won't ever have to use it again. EVER!!! :cold_sweat::tired_face:

Will give this a go in a couple of days then. You all on El Capitan?

tonivdv commented 8 years ago

Yup I'm on el capitan.

blueimp commented 8 years ago

I'm on El Capitan as well.

Understood that you don't wanna install VirtualBox again, although I have to say with @tonivdv's script here and docker-machine 0.5+ the default VirtualBox docker machine is on par with the Parallels version performance-wise.

tonivdv commented 8 years ago

Hello,

I just tested again with latest versions (docker 1.9.1) and it works.

Did you have the time to check this again @ianbytchek ?

Cheers

iby commented 8 years ago

No luck with virtual box either. I take there's something in my OS X configuration. Any ideas what might that be?

ianbytchek@ibmbp:~$ docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM
default   -        parallels    Saved                                 
tst       -        virtualbox   Running   tcp://192.168.99.100:2376   
ianbytchek@ibmbp:~$ docker-machine-nfs tst
[INFO] machine presence ...             OK 
[INFO] machine running ...          OK 
[INFO] Lookup mandatory properties ...      OK 

    - Machine IP: 192.168.99.100 
    - Network ID: vboxnet0 
    - NFSHost IP: 192.168.99.1 

[INFO] Configure NFS ... 

 !!! Sudo will be necessary for editing /etc/exports !!! 
Password:
                        OK 
[INFO] Configure Docker Machine ...         OK 
[INFO] Restart Docker Machine ...       OK 
[INFO] Verify NFS mount ...             FAIL

Cannot detect the NFS mount :( 
iby commented 8 years ago

Ok. Figured it out. It's firewall blocking something. My config is pretty simple… what exactly should be allowed in there for this to work?

image

tonivdv commented 8 years ago

@ianbytchek No idea :) But this will maybe help: http://serverfault.com/questions/377170/which-ports-do-i-need-to-open-in-the-firewall-to-use-nfs