Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xnohat/b91565876d1480f1503417010e62b979 to your computer and use it in GitHub Desktop.
Save xnohat/b91565876d1480f1503417010e62b979 to your computer and use it in GitHub Desktop.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment