# HG changeset patch # User Oleksandr Gavenko # Date 1544992668 -7200 # Node ID a99f277a9eaedb37bab3a462ac4c29fd45ecd3bd # Parent e538e158c38bd3b248593866fc4f3612f47275b8 Exporting boxes. diff -r e538e158c38b -r a99f277a9eae vagrant.rst --- a/vagrant.rst Fri Dec 14 21:33:27 2018 +0200 +++ b/vagrant.rst Sun Dec 16 22:37:48 2018 +0200 @@ -45,11 +45,12 @@ Managing boxes ============== -Adding new box from catalog:: +Store new box from catalog locally:: $ vagrant box add ubuntu/trusty64 + $ vagrant box add --provider virtualbox hashicorp/precise64 -Checking for box updates:: +Check for box updates:: $ cd $BOXDIR $ vagrant box outdated @@ -89,6 +90,39 @@ https://www.vagrantup.com/docs/boxes/versioning.html Box Versioning. +Exporting boxes +=============== + +Any VirtualBox VM can be packages as Vagrant box. Find VM name or UUID with:: + + $ VBoxManage list vms + +Pass it to one of:: + + $ vagrant package --base $VM_NAME + $ vagrant package --base $VM_UUID + $ vagrant package --base $VM_NAME --output my.box + $ vagrant package --base $VM_UUID --output my.box + +If you are in Vagrant managed directory (with ``.vagrant`` subdirectory) it is as simple as:: + + $ vagrant package + +.. note:: Only one VM is packages even if Vagrant file defines several VMs. + +Import packages box:: + + $ vagrant box add --name $NAME /path/to/new.box + ... + $ vagrant init $NAME + ... + $ vagrant up + +https://www.vagrantup.com/docs/boxes/base.html + Create own vagrant image. +https://www.vagrantup.com/docs/cli/package.html + ``package`` command. + Managing plugins ================