Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Using NFS with boot2docker

NFS Server

OS X Host

Note: you will need sudo access. Add the following to /etc/exports

/Users -alldirs -maproot=root:wheel -network -mask

Restart NFS:

sudo nfsd restart

Linux Host

Note: you will need sudo access and NFS server (sudo apt-get install -y nfs-kernel-server on debian). Add the following to /etc/exports


Restart NFS

sudo systemctl restart nfs-kernel-server


You will need to remove the existing shared folder at /Users (only if on OS X). You can do this with (make sure the VM is stopeed):

VBoxManage sharedfolder remove [vm-name] --name Users

Start the VM and ssh into it. Add the following to /var/lib/boot2docker/profile:

OS X Host

mkdir /Users
sudo mount -t nfs -o vers=3,nolock,udp /Users

Linux Host

mkdir -p /mnt/home
mount -t nfs -o vers=3,nolock,udp /mnt/home
for USERDIR in /mnt/home/*
    USER=`basename $USERDIR`
    ln -sf /mnt/home/$USER /home/$USER

Reboot the VM. You should now have NFS in b2d and be able to do things like:

docker run -v $(pwd):/dest/in/container ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment