How to clone a Vagrant environment

Contains information related to the Vagrant

How to Clone a Vagrant Environment

Execute the following commands:

  1. Move to the folder containing the Vagrantfile to be used as the base for cloning.
  2. vagrant package [vm name] –output [desired name.box]
  • Check the vm name with ‘$ vagrant status’, by default it is ‘default’
  • For example, run vagrant package default –output ubuntu1604base.box
  • Or simply execute vagrant package
  1. vagrant box add [desired name] [desired name.box]
  • For example, ‘vagrant box add ubuntu1604base ubuntu1604base.box’
  1. Check if it was added with vagrant box list
  • If added successfully, [desired name] will be displayed
  1. Move to the desired location for cloning
  2. Execute ‘vagrant init [desired name]’
  3. Check if Vagrantfile is created
  • It’s convenient to clone the Vagrantfile and merge with the created one
  1. Execute vagrant up

See also