» Init

Command: vagrant init [name [url]]

This initializes the current directory to be a Vagrant environmentby creating an initial Vagrantfile ifone does not already exist.

If a first argument is given, it will prepopulate the config.vm.boxsetting in the created Vagrantfile.

If a second argument is given, it will prepopulate the config.vm.box_urlsetting in the created Vagrantfile.

» Options

  • —box-version - (Optional) The box version or box version constraint to addto the Vagrantfile.

  • —force - If specified, this command will overwrite any existingVagrantfile.

  • —minimal - If specified, a minimal Vagrantfile will be created. ThisVagrantfile does not contain the instructional comments that the normalVagrantfile contains.

  • —output FILE - This will output the Vagrantfile to the given file.If this is "-", the Vagrantfile will be sent to stdout.

  • —template FILE - Provide a custom ERB template for generating the Vagrantfile.

» Examples

Create a base Vagrantfile:

  1. $ vagrant init hashicorp/precise64

Create a minimal Vagrantfile (no comments or helpers):

  1. $ vagrant init -m hashicorp/precise64

Create a new Vagrantfile, overwriting the one at the current path:

  1. $ vagrant init -f hashicorp/precise64

Create a Vagrantfile with the specific box, from the specific box URL:

  1. $ vagrant init my-company-box https://boxes.company.com/my-company.box

Create a Vagrantfile, locking the box to a version constraint:

  1. $ vagrant init --box-version '> 0.1.5' hashicorp/precise64