Skip to content
This repository was archived by the owner on Jan 1, 2021. It is now read-only.
This repository was archived by the owner on Jan 1, 2021. It is now read-only.

nfs share / guest to host #64

Open

Description

@aheissenberger

I have allready added nfs-utilities to the ISO but have some troubles to forward the nfs ports to osx.

/etc/sysconfig/nfs:
RQUOTAD_PORT=875
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
STATD_PORT=662

this plus 111 TCP/UDP, 2049 TCP/UDP are forwarded by virtual box to local host.

I have no problem to mount the share local inside the vm but mounting the share from OSX gives me:

sudo mount -o resvport,vers=3 127.0.0.1:'/var/lib/docker/share' '/Users/ah/tmp/mnt'
mount_nfs: can't mount /var/lib/docker/share from 127.0.0.1 onto /Users/ah/tmp/mnt: No such file or directory

Activity

  1. jpetazzo commented on Jan 9, 2014

    @jpetazzo
    Contributor

    Did you consider using the 9p filesystem?
    It just requires a TCP connection (no portmapper etc.) and is dead simple to setup on the server side.
    See https://gist.github.com/jpetazzo/5668338 for an example (that has to be adapted of course, since the example involves containers).

  2. aheissenberger commented on Jan 10, 2014

    @aheissenberger
    ContributorAuthor

    I have not found a 9p Server/Client for OSX

  3. jpetazzo commented on Jan 10, 2014

    @jpetazzo
    Contributor

    Argh, I thought that diod might be available for OSX.
    It should be straightforward to compile, but I never tried that (I don't
    use OSX). :-(

    On Thu, Jan 9, 2014 at 4:54 PM, aheissenberger [email protected]:

    I have not found a 9p Server/Client for OSX

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/64#issuecomment-31993778
    .

    @jpetazzo https://twitter.com/jpetazzo
    Latest blog post: http://jpetazzo.github.io/2013/12/07/pxe-netboot-docker/

  4. aheissenberger commented on Jan 10, 2014

    @aheissenberger
    ContributorAuthor

    I have go it working:

    1. I am using a host only network on eth1
    2. exporting a share from OSX does work
    3. exporting a share from docker vm works

    open problems:

    1. exporting a share from OS only works if security is set to no - which I only can set with "NFS Manager" - not able to get this configuration in my /etc/exports config:
      /Users/ah/SVN-Checkouts/DEV/dev -network 192.168.56.0 -mask 255.255.255.0

    You can find a working new boot2docker which adds the hostonly adaper and the ISO which include the nfs utilities here:
    https://github.com/aheissenberger/boot2docker

    do not forget to start the nfs client or server inside the VM:
    sudo /usr/local/etc/init.d/nfs-server start
    sudo /usr/local/etc/init.d/nfs-client start

  5. aheissenberger commented on Jan 11, 2014

    @aheissenberger
    ContributorAuthor

    Here is the patch to use it - but the code is not finally cleaned up and you need to rebuid the ISO:
    https://github.com/aheissenberger/boot2docker/tree/feature/shared-folder-nfs

  6. aheissenberger commented on Jan 13, 2014

    @aheissenberger
    ContributorAuthor

    Here is the link to the bug preventing tiny core to support NAT and hostonly in a VM:
    https://bugs.busybox.net/show_bug.cgi?id=6788

    my code above contains the fix already

  7. schickling commented on Jan 14, 2014

    @schickling
    Contributor

    Thanks a ton for your efforts @aheissenberger !

  8. aheissenberger commented on Jan 14, 2014

    @aheissenberger
    ContributorAuthor

    @schickling the existing code in in my repository creates an ISO with nfs support but at the moment you have to manuel mount the shares.

    @steeve would be nice if the docker remote client could tell the daemon to handle the mounting if the hostpath contains an IP - e.g:
    docker run -v 192.168.56.1:/var/logs:/var/host_logs:ro ubuntu bash

  9. schickling commented on Jan 20, 2014

    @schickling
    Contributor

    @aheissenberger Will you open a PR with your NFS settings? :shipit:

  10. kainz commented on Jan 21, 2014

    @kainz
  11. aheissenberger commented on Jan 23, 2014

    @aheissenberger
    ContributorAuthor

    Finished - sharing a directory from the host to a container in a VM works:

    boot2docker cmd run -d -p 8081:80 -name webserver -v ~/SVN-Checkouts/DEV/dev:/app tutum/apache-php /run.sh
    

    the CMD option will magically convert the input to docker run -d -p 0.0.0.0::80 -name webserver -v /var/lib/docker/share/809218c9bf1bdfa803dfedb65ef0de83:/app tutum/apache-php /run.sh and will mount the directory and will set the port forwarding #104 .

    mount 192.168.56.1:/Users/franz/SVN-Checkouts/DEV/dev /var/lib/docker/share/809218c9bf1bdfa803dfedb65ef0de83
    VBoxManage controlvm boot2docker-vm natpf1 zfp8081,tcp,127.0.0.1,8081,0.0.0.0,49154
    

    It expects/User/franz/SVN-Checkouts/ to be exported by the NFS-server on the host

    $ cat /etc/exports
    /Users/franz/SVN-Checkouts -alldirs -ro -network 192.168.56.0 -mask 255.255.255.0
    

    You will need my ISO with NFS installed, 2nd host only interface and my ./boot2docker script with the ./boot2docker cmd option
    https://github.com/aheissenberger/boot2docker

    ToDO:
    [ ] more testing
    [ ] there is no clean up of the mounted volums after the container gets stopped

  12. vincentbernat commented on Jul 2, 2014

    @vincentbernat

    Will this eventually be merged to boot2docker?

  13. mitar commented on Jul 11, 2014

    @mitar

    +1

  14. sreuter commented on Jul 17, 2014

    @sreuter

    +1

  15. g12n commented on Jul 17, 2014

    @g12n

    +1

  16. 71 remaining items

  17. chouclee commented on Jun 9, 2015

    @chouclee

    @olalonde Thanks for your script.
    Have you seen any improvement using NFS? What is your benchmark?
    I used Docker to deploy a Tomcat webapp located in host's folder, but I couldn't see any improvement using NFS. Host would use about 12s to deploy, docker would use 45-120s(usually 60s) with vboxsf, and 32-120s with NFS (usually 60s).

  18. olalonde commented on Jun 9, 2015

    @olalonde

    @chouclee to be honest, I can't say I paid much attention to that. The primary reason I'm using NFS is that LevelDB refuses to work with vboxsf. I'd be curious to see some benchmark as well though and optimise the script if possible.

  19. chouclee commented on Jun 9, 2015

    @chouclee

    @olalonde Ah, I see. I'm curious because most people say NFS could be 1.3-2x slower than rsync which is almost as fast as native. Anyway, thanks for sharing the script.

  20. vincepri commented on Jun 23, 2015

    @vincepri

    I am using https://github.com/dduportal/boot2docker-vagrant-box that seems to fix all the crazy issues I was having with boot2docker. I am not sure why Vagrant + NFS is much faster that NFS on official boot2docker though.

    I set it up making it on the same IP address of boot2docker and using the same certs path.

  21. heyyoyo commented on Jul 4, 2015

    @heyyoyo

    Anyone achieved success to mount a Windows NFS folder from boot2docker vm with the NFS Windows server WinNFSd ?
    I'm using this version : https://bitbucket.org/yannschepens/winnfsd-new

    After starting the nfs-client,
    Everytime I tried to mount my Windows folder I have this error:

    pmap_getmaps.c: rpc problem: RPC: Procedure unavailable
    mount: RPC: Unable to receive; errno = Connection refused
    mount: mounting 10.0.0.1:/c/web on /var/www failed: Bad file descriptor

    But I could see WinNFSd is seeing the request because it logs:
    PORTMAP NOTIMP

  22. heyyoyo commented on Jul 5, 2015

    @heyyoyo

    I replaced winnfsd by HanWIN nfs server and now it works as expected. It's strange winnfsd was working with vagrant and regular ubuntu. The nfs client is probably different

  23. ain commented on Sep 1, 2015

    @ain

    👍 for a consistent fix. It's a killer for the whole concept, esp. on large projects.

  24. douglasmiranda commented on Sep 17, 2015

    @douglasmiranda
  25. squaresurf commented on Sep 18, 2015

    @squaresurf

    @douglasmiranda, that looks like the future. I'm gonna give it a shot here soon.

    I like that it doesn't try to replace docker-machine so you get the benefits of the latest development on docker-machine. Which is why I had to stop using dinghy. I needed to use the latest version of docker, but dinghy was behind.

  26. douglasmiranda commented on Sep 19, 2015

    @douglasmiranda

    Just a feedback about docker-machine-nfs.

    It works beautifully :D

  27. mikzalais commented on Sep 23, 2015

    @mikzalais

    I've got issue with boot2docker box when trying this.
    If will not connect to my nfs share. In fact it was not able to ping the host after it was restarted. It was able to ping 192.168.99.1 only at first boot up after machine is created. After restarting it was not, although it was accessing internet ok.
    Update to latest 1.8.2a of docker-toolbox was the same.

  28. intellix commented on Oct 4, 2015

    @intellix

    Damn, docker-machine-nfs was easily the best solution. Tried docker-osx-dev but it didn't really install correctly. docker-machine-nfs was a one command thing and it's an instant fix

  29. georgediaz88 commented on Oct 7, 2015

    @georgediaz88

    same here. Already loving docker-machine-nfs just because I can naturally use and feel comfortable with docker-machine vs what some of these other tools do.

  30. added
    question
    on Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions