Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving and sharing changes made to Vagrant box

Tags:

vagrant

I setup an Ubuntu 13.04 box from www.vagrantbox.es. Post that I made changes to the box - installed ruby, rails, git, mysql, ngnix, etc. How do I share the modified box with someone else?

like image 257
zodvik Avatar asked Mar 04 '14 19:03

zodvik


People also ask

Where are vagrant boxes saved?

As mentioned in the docs, boxes are stored at: Mac OS X and Linux: ~/. vagrant. d/boxes.

How do I update my vagrant box?

Command: vagrant box update This command updates the box for the current Vagrant environment if there are updates available. The command can also update a specific box (outside of an active Vagrant environment), by specifying the --box flag. Note that updating the box will not update an already-running Vagrant machine.


2 Answers

After making your changes, use vagrant package in the directory with the Vagrantfile. It will shut the machine down and start saving it to a file.

You'll end up with a boxfile in that directory that you can share.

like image 155
gmoney Avatar answered Sep 28 '22 08:09

gmoney


As already answered, vagrant package creates a new base box out of an existing VM.

Anyway "the Vagrant way" is to use and share a Vagrantfile with provisioners. This way the installation of the software is repeatable. The downside is that initial vagrant up takes longer while it installs all the software, but on the other hand the shared base box is smaller. Depends on your use case what is the best.

If you choose to share a pre-installed image you can still benefit from automated provisioning using e.g. Packer to build the box.

like image 21
tmatilai Avatar answered Sep 28 '22 07:09

tmatilai