Skip to content

Instantly share code, notes, and snippets.

@suplo
Created March 25, 2014 09:34
Show Gist options
  • Save suplo/9758118 to your computer and use it in GitHub Desktop.
Save suplo/9758118 to your computer and use it in GitHub Desktop.
Clone vagrant box
Create a new box from your existing vm:
cd into the directory with your Vagrant file
run vagrant package This will export a box file called package.box by default
run vagrant box add foo package.box virtualbox to add package.box to your existing boxes. (Assuming you are using virtualbox and not VMWare)
run vagrant box list to verify it was added.
Now you can just create a new folder, run vagrant init as normal and set your box to the following:
config.vm.box = "foo"
The new VM will spin up with the exact data that was present in the previous VM.
Vagrant Documentation
@ror6ax
Copy link

ror6ax commented Oct 26, 2014

Hi,
Ever thought about making this a pull req as a separate command?
"vagrant clone vm1"?

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