website/content/docs/cli/init.mdx
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
[!IMPORTANT]
Documentation Update: Product documentation previously located in/websitehas moved to thehashicorp/web-unified-docsrepository, where all product documentation is now centralized. Please make contributions directly toweb-unified-docs, since changes to/websitein this repository will not appear on developer.hashicorp.com. ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
Command: vagrant init [name [url]]
This initializes the current directory to be a Vagrant environment by creating an initial Vagrantfile if one does not already exist.
If a first argument is given, it will prepopulate the config.vm.box
setting in the created Vagrantfile.
If a second argument is given, it will prepopulate the config.vm.box_url
setting in the created Vagrantfile.
--box-version - (Optional) The box version or box version constraint to add
to the Vagrantfile.
--force - If specified, this command will overwrite any existing
Vagrantfile.
--minimal - If specified, a minimal Vagrantfile will be created. This
Vagrantfile does not contain the instructional comments that the normal
Vagrantfile 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.
Create a base Vagrantfile:
$ vagrant init hashicorp/bionic64
Create a minimal Vagrantfile (no comments or helpers):
$ vagrant init -m hashicorp/bionic64
Create a new Vagrantfile, overwriting the one at the current path:
$ vagrant init -f hashicorp/bionic64
Create a Vagrantfile with the specific box, from the specific box URL:
$ vagrant init my-company-box https://example.com/my-company.box
Create a Vagrantfile, locking the box to a version constraint:
$ vagrant init --box-version '> 0.1.5' hashicorp/bionic64