summaryrefslogtreecommitdiff
path: root/devdocs/vagrant/cli%2Finit.html
blob: 0b074a05bea348ef772bd4f30232499ccdc52d3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<h1 id="init">  Init </h1> <p><strong>Command: <code>vagrant init [name [url]]</code></strong></p> <p>This initializes the current directory to be a Vagrant environment by creating an initial <a href="../vagrantfile/index">Vagrantfile</a> if one does not already exist.</p> <p>If a first argument is given, it will prepopulate the <code>config.vm.box</code> setting in the created Vagrantfile.</p> <p>If a second argument is given, it will prepopulate the <code>config.vm.box_url</code> setting in the created Vagrantfile.</p> <h2 id="options">  Options </h2> <ul> <li>
<p><a href="#box-version"><code>--box-version</code></a> - (Optional) The box version or box version constraint to add to the <code>Vagrantfile</code>.</p> </li> <li>
<p><a href="#force"><code>--force</code></a> - If specified, this command will overwrite any existing <code>Vagrantfile</code>.</p> </li> <li>
<p><a href="#minimal"><code>--minimal</code></a> - If specified, a minimal Vagrantfile will be created. This Vagrantfile does not contain the instructional comments that the normal Vagrantfile contains.</p> </li> <li>
<p><a href="#output-file"><code>--output FILE</code></a> - This will output the Vagrantfile to the given file. If this is "-", the Vagrantfile will be sent to stdout.</p> </li> <li>
<p><a href="#template-file"><code>--template FILE</code></a> - Provide a custom ERB template for generating the Vagrantfile.</p> </li> </ul> <h2 id="examples">  Examples </h2> <p>Create a base Vagrantfile:</p> <div class="highlight"><pre class="highlight shell" data-language="shell">$ vagrant init hashicorp/precise64
</pre></div>
<p>Create a minimal Vagrantfile (no comments or helpers):</p> <div class="highlight"><pre class="highlight shell" data-language="shell">$ vagrant init -m hashicorp/precise64
</pre></div>
<p>Create a new Vagrantfile, overwriting the one at the current path:</p> <div class="highlight"><pre class="highlight shell" data-language="shell">$ vagrant init -f hashicorp/precise64
</pre></div>
<p>Create a Vagrantfile with the specific box, from the specific box URL:</p> <div class="highlight"><pre class="highlight shell" data-language="shell">$ vagrant init my-company-box https://boxes.company.com/my-company.box
</pre></div>
<p>Create a Vagrantfile, locking the box to a version constraint:</p> <div class="highlight"><pre class="highlight shell" data-language="shell">$ vagrant init --box-version '&gt; 0.1.5' hashicorp/precise64
</pre></div><div class="_attribution">
  <p class="_attribution-p">
    &copy; 2010&ndash;2018 Mitchell Hashimoto<br>Licensed under the MPL 2.0 License.<br>
    <a href="https://www.vagrantup.com/docs/cli/init.html" class="_attribution-link">https://www.vagrantup.com/docs/cli/init.html</a>
  </p>
</div>