We can manage vagrant boxes using the vagrant box sub commands.
Let's run that with the help flag by typing dash dash help and see what sub commands are available.
So let's type vagrant box.
Dash, dash.
Help.
And we get this output.
As you can see with this version of Vagrant, I've got seven sub commands.
The available sub commands are at least outdated.
Prune, remove, repackage and update.
With each of these commands we can provide the dash dash help flag to see what additional arguments
are available.
Now let's review this in detail.
Let's start with list in vagrant boxes.
The list sub command will be list in the boxes installed within vagrant along with the provider that
backs the box.
So let's type vagrant box list and the output will show all the boxes available within vagrant.
We can remove the box with the remove sub command.
We need to provide the name of the box and the provider that backs it.
For example Vagrant box remove hashicorp slash precise 64.
You could also add the provider for example virtual box.
So let's see it in action.
I'll type vagrant box remove hashicorp slash precise 64 and the output will be the message that the
vagrant is removing box with provider virtual box.
Now let's power up the virtual machine using the Vagrant app command.
If the environment was not previously suspended, Vagrant then checks to see if the base box has already
been downloaded onto the machine.
If it hasn't, it will download it.
Vagrant will then perform the following.
Copy the base box.
Create a new virtual machine with the relevant provider.
Remember that the default being virtual box.
Then it will forward any configured ports by default.
It'll forward port 22, which is SSH on the VM to port 2222 on the host.
This will allow us to connect to to the VM, then it will boot or power up the VM and configure and
enable networking so that we can communicate with the VMM.
Then Vagrant will map shared folders between the host and the guest.
By default it will map the folder containing the vagrant project to slash vagrant on the guest machine,
and after that it will run any provisioning tools that are set up such as Puppet and Ansible share for
SSH SSH provisioning.
After powering up the virtual machine, the output will look something like mine.
As you can see, lots of informational messages from Vagrant like search the name of the VM Forward
and ports button, VM and so on.