virtualbox+vagrant学习-2(command cli)-6-vagrant init命令

Init——创建Vagrantfile文件

格式:

vagrant init [options] [name [url]]

通过创建初始的Vagrantfile文件(如果不存在的话),将当前目录初始化为vagrant环境。

userdeMacBook-Pro:~ user$ vagrant init -h
Usage: vagrant init [options] [name [url]]

Options:

        --box-version VERSION        Version of the box to add 添加的box的版本
    -f, --force                      Overwrite existing Vagrantfile 复写已经存在的Vagrantfile文件
    -m, --minimal                    Use minimal Vagrantfile template (no help comments). Ignored with --template
                                     使用最小化的Vagrantfile模版(这种模版是没有帮助注释的),使用它将会忽视--template标签的使用
        --output FILE                Output path for the box. '-' for stdout  box的输出路径,如果FILE为'-',意味输出的Vagrantfile将送到stdout
        --template FILE              Path to custom Vagrantfile template 定制Vagrantfile模版的路径
    -h, --help                       Print this help 打印帮助信息

如果给出第一个参数,它将在创建的流浪者文件中预填充config.vm.box
如果给出第二个参数,它将在创建的Vagrantfile中预填充config.vm.box_url

 

例子:

创建基本的Vagrantfile:

$ vagrant init hashicorp/precise64

创建最小化的Vagrantfile文件 (无注释):

$ vagrant init -m hashicorp/precise64

创建新的Vagrantfile文件, 将当前路径下的覆盖:

$ vagrant init -f hashicorp/precise64

为来自指定box URL的执行box创建Vagrantfile文件:

$ vagrant init my-company-box https://boxes.company.com/my-company.box

创建一个Vagrantfile文件,对box进行版本限制:

$ vagrant init --box-version '> 0.1.5' hashicorp/precise64

 

 

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值