Skip to content

Instantly share code, notes, and snippets.

@gecbla
Forked from suplo/vagrant
Last active March 7, 2016 18:30
Show Gist options
  • Save gecbla/9525c33af29e962555aa to your computer and use it in GitHub Desktop.
Save gecbla/9525c33af29e962555aa to your computer and use it in GitHub Desktop.
# Vagrant Documentation
# @see http://docs.vagrantup.com/v2/cli/package.html
# @see http://stackoverflow.com/questions/19094024/is-there-any-way-to-clone-a-vagrant-box-that-is-already-installed
# <command-1>
vagrant package --base <virtual-box-name-or-uuid> ^
--output </path/to/package-name.box:package.box>
# <command-2>
vagrant box add --name <box-name> ^
--provider virtualbox ^
</path/to/package.box>
# <command-3>
vagrant box list
# <command-4>
vagrant init
##########################################
# Create a new box from your existing vm #
##########################################
# cd into the directory with your Vagrant file
run "<command-1>"
This will export box to a file (package.box is default box name).
run "<command-2>" to add package.box to your existing boxes.
Assuming you are using VirtualBox and not VMWare.
run "<command-3>" to verify it was added.
# Now you can just create a new folder, run "<command-4>" as normal and set your box to the following:
config.vm.box = "box-name"
# The new VM will spin up with the exact data that was present in the previous VM.
:-)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment