Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Where does vagrant search for a vagrant file?


Asked by Emmy Hall on Dec 14, 2021 FAQ



When you run any vagrant command, Vagrant climbs up the directory tree looking for the first Vagrantfile it can find, starting first in the current directory. So if you run vagrant in /home/mitchellh/projects/foo , it will search the following paths in order for a Vagrantfile, until it finds one:
In addition,
The answer is: The Vagrantfile. And by default it is stored in the current working directory — the directory from which you run vagrant init. Vagrantfile Everything Vagrant does centers around this file. It should be simply named “Vagrantfile” without any file extension.
In this manner, Box files made for Vagrant 1.0.x (the VirtualBox export tar files) continue to work with Vagrant today. When Vagrant encounters one of these old boxes, it automatically updates it internally to the new format. Today, there are three different components:
Similarly,
Vagrant is meant to run with one Vagrantfile per project, and the Vagrantfile is supposed to be committed to version control. This allows other developers involved in the project to check out the code, run vagrant up, and be on their way. Vagrantfiles are portable across every platform Vagrant supports.
Also Know,
In the example above, the username is hashicorp, and the box is bionic64. You can also specify boxes via URLs or local file paths, but that will not be covered in the getting started guide. Warning: Namespaces do not guarantee canonical boxes, and anyone can publish boxes on Vagrant Cloud.