Mount the remote volume through whatever means. Example, sshfs
:
sshfs -o allow_other,defer_permissions,IdentityFile=~/.ssh/id_rsa <remote_user>@host:/path/to/mount /path/to/mount
Stop the machine and add the new shared folder to the VirtualBox config.
docker-machine stop <machine name>
VBoxManage sharedfolder add <machine name> --name /path/to/mount --hostpath path/to/mount --automount
docker-machine start <machine name>
docker-machine ssh <machine name>
Edit or create the file /var/lib/boot2docker/bootlocal.sh
with the contents:
mkdir -p /path/to/mount
mount -t vboxsf -o uid=<uid>,gid=<gid> /path/to/mount /path/to/mount
Set <uid>
and <gid>
to the uid/gid of the user you ultimately want the mount to appear as in containers.
Restart the docker machine. Start a docker container with a volume mount of /path/to/mount
.
Enjoy.