Port
格式:
vagrant port [options] [name|id]
端口命令显示映射到主机端口的客户端口的完整列表
userdeMacBook-Pro:~ user$ vagrant port -h Usage: vagrant port [options] [name|id] Options: --guest PORT Output the host port that maps to the given guest port 输出映射到给定客户端口的主机端口 --machine-readable Display machine-readable output 显示机器可读的输出 -h, --help Print this help 打印帮助信息
例子:
得到的是本机所有机器的端口映射信息
userdeMacBook-Pro:~ user$ vagrant port The forwarded ports for the machine are listed below. Please note that these values may differ from values configured in the Vagrantfile if the provider supports automatic port collision detection and resolution. 22 (guest) => 2222 (host)
如果只想得到某个机器的,可以指明其名字或id,如:
$ vagrant port my-machine