Vagrant CLI commands Here is a comprehensive list of Vagrant CLI commands, including basic commands, advanced operations, and useful configurations.
-
Initialize a new Vagrant project:
vagrant init [BOX_NAME]
-
Start and provision the Vagrant environment:
vagrant up
-
Halt the Vagrant environment:
vagrant halt
-
Suspend the Vagrant environment (saves the state):
vagrant suspend
-
Resume a suspended Vagrant environment:
vagrant resume
-
Destroy the Vagrant environment (removes all traces):
vagrant destroy
-
Reload the Vagrant environment (reboots and applies configuration changes):
vagrant reload
-
SSH into the Vagrant box:
vagrant ssh
-
Check the status of the Vagrant environment:
vagrant status
-
Provision the Vagrant environment without starting it:
vagrant provision
-
Validate the Vagrantfile:
vagrant validate
-
List available boxes:
vagrant box list
-
Add a new box:
vagrant box add BOX_NAME [BOX_URL]
-
Remove a box:
vagrant box remove BOX_NAME
-
Update the Vagrant box:
vagrant box update
-
Show information about the current box:
vagrant box info BOX_NAME
-
Show detailed information about the current environment:
vagrant global-status
-
Package the Vagrant box:
vagrant package [OPTIONS]
-
Upload a package to Vagrant Cloud:
vagrant cloud publish [OPTIONS]
-
Download a Vagrant box from Vagrant Cloud:
vagrant cloud box add [OPTIONS]
-
List installed plugins:
vagrant plugin list
-
Install a plugin:
vagrant plugin install PLUGIN_NAME
-
Update a plugin:
vagrant plugin update PLUGIN_NAME
-
Uninstall a plugin:
vagrant plugin uninstall PLUGIN_NAME
-
List available plugins:
vagrant plugin search PLUGIN_NAME
-
Update all plugins:
vagrant plugin update
-
Forward a port for the Vagrant box:
vagrant port
-
Display the Vagrant box's SSH configuration:
vagrant ssh-config
-
Run a specific provisioning script:
vagrant provision --provision-with SCRIPT_NAME
-
Disable provisioning during
vagrant up
:vagrant up --no-provision
-
Force provisioning on
vagrant up
:vagrant up --provision
-
Snapshot a Vagrant environment (create a checkpoint):
vagrant snapshot save SNAPSHOT_NAME
-
List snapshots:
vagrant snapshot list
-
Restore a snapshot:
vagrant snapshot restore SNAPSHOT_NAME
-
Delete a snapshot:
vagrant snapshot delete SNAPSHOT_NAME
-
Push a Vagrant box to a private repository:
vagrant box add BOX_NAME --provider=PROVIDER --box-version=VERSION
This list of Vagrant CLI commands covers essential tasks for managing Vagrant environments, including initialization, configuration, provisioning, and advanced operations. Use these commands to efficiently create, configure, and manage development environments with Vagrant.