Skip to content

Instantly share code, notes, and snippets.

@pcolazurdo
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcolazurdo/f8eeb0a1cfac53754fb5 to your computer and use it in GitHub Desktop.
Save pcolazurdo/f8eeb0a1cfac53754fb5 to your computer and use it in GitHub Desktop.
Setting Up a good Boot2docker Image - some ideas

Setting Shared Folders on VirtualBox & Boot2Docker

Imagine that you want to share a host folder named c:\Buildbox\src into the guest box on /external/src. In this case you should do something like this:

On the Windows box

boot2docker save
cd "C:\Program Files\Oracle\VirtualBox"
vboxmanage sharedfolder add boot2docker-vm --name extsrc --hostpath c:\BuildBox
VBoxManage setextradata boot2docker-vm VBoxInternal2/SharedFoldersEnableSymlinksCreate/extsrc 1
boot2docker start
boot2docker ssh

On the boot2docker vm

$ sudo mkdir /external
$ sudo mkdir /external/src
$ sudo chown -R docker:docker /external
$ sudo vi /var/lib/boot2docker/profile
  #! /bin/sh
  mount -t vboxsf extsrc /external/src
$ sudo chmod 770 /var/lib/boot2docker/profile
$ sudo chown docker:docker /var/lib/boot2docker/profile

Exit the box and run

boot2docker save
boot2docker start
boot2docker ssh
$ mount

And you should be able to see a line like :

none on /external/src type vboxsf (rw,nodev,relatime)

Additionally ... you may need symbolic links (i.e. npm install) ... to activate that you will need:

If your user is of the Administrator type (rather than a Standard account), there's no way to run VB with symlinks working without the UAC prompt cos you have to start the VBox as Administrator (cmd with elevated privileges)

Make sure your user has proper access to the shared folder on host system. As mentioned here earlier, execute VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1 in a console from the C:\Program Files\VirtualBox folder. Don't forget to substitute VM_NAME with the name of your VM and SHARE_NAME with the name of the shared folder (as it appears in the VM settings).

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