virtualbox+vagrant学习-2(command cli)-10-vagrant Port命令

本文详细介绍了如何使用Vagrant命令行工具查看虚拟机的端口映射情况,包括显示所有机器的端口映射信息及特定机器的端口映射。提供了具体的命令用法和选项说明。

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

 

转载于:https://www.cnblogs.com/wanghui-garcia/p/10170297.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值