You message someone in the same room to
There aren't many Vagrant commands because Hashicorp design their products with the do one thing well philosophy.
vagrant init is like
git init and
It creates and deposits a Vagrantfile into the folder. Once there you can use
vagrant up to start up your new basic virtual machine.
The rubber hits the road with this command. A virtual machine is created via a hypervisor like Oracle's VirtualBox.
You (or your script) can issue
vagrant up from a folder without (or even with) a Vagrantfile. All you need do is to set the VAGRANT_CWD environment variable with an absolute path to the folder containing the Vagrantfile.
Remember the path is to the folder - not the file.
If you want to know which port was used, where the ssh private key is, what the user is called - you turn to
The results will look like this.
Host default HostName 127.0.0.1 User vagrant Port 2222 UserKnownHostsFile /dev/null StrictHostKeyChecking no PasswordAuthentication no IdentityFile "/home/apollo/eco-platform.cluster/.vagrant/machines/default/virtualbox/private_key" IdentitiesOnly yes LogLevel FATAL
You will use the mapped shared folder between the virtual machine and the host, again and again. From the virtual machine it is mounted at /vagrant.
If you want to enter the virtual machine from another computer where
vagrant ssh is not n option, you'll need the host/ip address, user and private key.
The private key lives off the shared folder at this location.
id name provider state directory --- 0403361 default virtualbox running C:/Users/apollo/.../box1 8c8397a default virtualbox running C:/Users/apollo/.../box2
The ID is fed into other commands when you are not in the Vagrantfile directory.
Use vagrant destroy when you are in the same directory as the Vagrantfile for the box.
vagrant global-status vagrant destroy 0403361 vagrant destroy -f 8c8397a
The Are You Sure prompt will rear itself when destroying the first box. The -f switch means "force" and is best used in scripts.
vagrant global-status --prune
The box status list can get stale (after a restart for example). The simplest way to deal with this is to issue the vagrant global-status --prune command.
vagrant global-status --prune vagrant destroy ec6edf4 4a20a79 14ec14b 974d0a6 043e058 --force
You can script getting the box IDs into a list from the
vagrant global-status command.
Add the --force switch to disable the "Are you sure?" prompt.
Last edited by apollo, 2018-11-13 18:42:15