You might have a spun a VM and configured all your applications on it, and want to recreate the same VM without configuring it. For this, you can clone the existing configured vagrant box and create new ones from that.
Creating a VM clone using Vagrant
Follow the steps given below to set up a VM clone and start a new VM out of the cloned box.
Stop the running VM
If your configuring VM is in running state, halt it using the following vagrant command. By halting the VM you will get a consistent data clone.
Create a clone
Once your VM is in a halt state, execute the following package command to create a clone of your existing VM.
The above command will create a box named package.box in the same directory where you executed the package command. If you want a custom name for your box, you can add “–output NAME” flag with the above command.
Creating a VM from the new package.box
Create a new directory and create a vagrant file using the following command syntax.
The above command will initialize a Vagrantfile for the new VM. You can edit this vagrantfile if you want to change the default configuration.
Execute the following command to start the VM.
One the VM is up , you can ssh into the VM using the following command.