I'm trying to create a custom vagrant box for my team to use. The box is based off the base CentOS-x64-6.4-virtualbox-guest-additions-and-chef box. I vagrant up
the VM and installed a bunch of software on it. With the software in place, I created a custom Vagrantfile and then packaged the box with vagrant package --output "my-custom-centos.box" --vagrantfile Vagrantfile
and made it available.
Unfortunately, it turns out that when you pull down the shared box, the default shared directory that maps /vagrant
on the box to the current working directory doesn't work (folder is empty). Furthermore, adding additional custom working directories also has no effect. I can't seem to find any good resources for how best to package custom vagrant boxes and haven't seen anything like shared directories not working. Any help would be greatly appreciated.
When you add --vagrantfile Vagrantfile
to your package command, it embeds the Vagrantfile that the box was using into the package. I think the outermost Vagrantfile is supposed to take precedence over the others. The default shared folder is always where you set up your box (where your Vagrantfile and .vagrant folder are) and will change each time you start a box from a new place. When I make custom boxes, I leave the Vagrantfile out of the package and have not run into any problems with shared files. Hopefully some of that helps.