Vagrant是用ruby写的一个工具, 它的出现是为了更加容易的解决开发环境的一致性问题. 我们将会在本系列教程中学习到如何使用vagrant。在上一篇文章中我们使用了vagrant version/init/up/ssh等命令, 在本篇中对一些常用命令将做简单介绍.
命令一览
以下是vagrant1.8.5的命令一览。
命令 | 详细解释 |
---|---|
box | manages boxes: installation, removal, etc. |
connect | connect to a remotely shared Vagrant environment |
destroy | stops and deletes all traces of the vagrant machine |
global-status | outputs status Vagrant environments for this user |
halt | stops the vagrant machine |
help | shows the help for a subcommand |
init | initializes a new Vagrant environment by creating a Vagrantfile |
login | log in to HashiCorp’s Atlas |
package | packages a running vagrant environment into a box |
plugin | manages plugins: install, uninstall, update, etc. |
port | displays information about guest port mappings |
powershell | connects to machine via powershell remoting |
provision | provisions the vagrant machine |
push | deploys code in this environment to a configured destination |
rdp | connects to machine via RDP |
reload | restarts vagrant machine, loads new Vagrantfile configuration |
resume | resume a suspended vagrant machine |
share | share your Vagrant environment with anyone in the world |
snapshot | manages snapshots: saving, restoring, etc. |
ssh | connects to machine via SSH |
ssh-config | outputs OpenSSH valid configuration to connect to the machine |
status | outputs status of the vagrant machine |
suspend | suspends the machine |
up | starts and provisions the vagrant environment |
version | prints current and latest Vagrant version |
vagrant status
使用status命令可以确认当前vagrant的状态
[root@host31 ~]# vagrant status
Current machine states:
default running (virtualbox)
The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to sim