LinuxCommandLibrary

vagrant-init

TLDR

Create a Vagrantfile

$ vagrant init
copy

Create a Vagrantfile without instructional comments
$ vagrant init [[-m|--minimal]]
copy

Specify the box name and URL
$ vagrant init [box_name] [box_url]
copy

Create a Vagrantfile with a specific box version
$ vagrant init --box-version [version] [box_name]
copy

Send the Vagrantfile to stdout
$ vagrant init [[-o|--output]] -
copy

Overwrite an existing Vagrantfile
$ vagrant init [[-f|--force]]
copy

Provide a custom ERB template for generating the Vagrantfile
$ vagrant init --template [path/to/file.erb]
copy

SYNOPSIS

vagrant init [options] [box-name]

PARAMETERS

--force
    Overwrite existing Vagrantfile if it already exists

--output
    Specify the output file for the Vagrantfile

--box
    Specify the box to use for the Vagrantfile

DESCRIPTION

The vagrant-init command is used to initialize a new Vagrant project by creating a Vagrantfile. This file contains the configuration for the Vagrant environment, including the box to use, network settings, and other options.
When run, vagrant-init will prompt the user to select a box from the Vagrant Cloud, and then create a Vagrantfile with the selected box's configuration.

CAVEATS

The vagrant-init command will overwrite any existing Vagrantfile if the --force option is used. Be cautious when using this option to avoid losing existing configuration.

VAGRANTFILE SYNTAX

The Vagrantfile created by vagrant-init uses a Ruby-based syntax. Users can modify the file to customize their Vagrant environment, including configuring networks, ports, and provisioners.

BOX SELECTION

When running vagrant-init, users can select from a list of available boxes on the Vagrant Cloud. The selected box will be used to configure the Vagrantfile.

HISTORY

The vagrant-init command has been part of Vagrant since version 1.0. It was introduced as a way to simplify the process of creating a new Vagrant project, and has since become a standard part of the Vagrant workflow.

SEE ALSO

vagrant(1), vagrant-up(1), vagrant-ssh(1)

Copied to clipboard