Thursday, November 12, 2015

Vagrant - Useful Commands

This is a list of useful commands to use with Vagrant. These commands are useful to know and saves time on searching. To see the argument options along with the command, click on the command.


Vagrant Reference URL

Manage (add, remove, etc) virtual boxes

$vagrant box
// See the list of boxes installed into Vagrant.
$vagrant box list
// See any outdated boxes currently installed.
$vagrant box outdated
// Remove a box (and replace NAME_OF_BOX with the actual name of your box)
$vagrant box remove NAME_OF_BOX
// Update current box in Vagrant
$vagrant box update

Create, configure box

Create, configure guest machines according to local Vagrantfile.
$vagrant up

Suspend virtual box

Suspend guest machine in use (that Vagrant is managing) rather than shutting down or destroying it. This effectively saves the exact point-in-time state of the machine for resuming later (instead of full boot).
$vagrant suspend

Halt virtual box

Shuts down the running machine (box) Vagrant is managing. If graceful shutdown fails, then use argument 'force' to shut off completely.
$vagrant halt
$vagrant halt --force
$vagrant halt -f

Destroy virtual box

Stops the running machine (box) Vagrant is managing and destroys all resources created during the machine process. This leaves your machine in a clean state as if never used (like a reset button).
Use the 'force' argument to bypass the confirmation dialog.
$vagrant destroy
$vagrant destroy --force
$vagrant destroy -f

Reload virtual box

Halt followed by an Up.
$vagrant reload


No comments:

Post a Comment