Package
格式:
vagrant package [options] [name|id]
这将当前正在运行的VirtualBox或Hyper-V环境打包到一个可重用的box中。如果provider支持的话,此命令只能与基于provider实现的其他provider一起使用。
userdeMacBook-Pro:~ user$ vagrant package -h Usage: vagrant package [options] [name|id] Options: --base NAME Name of a VM in VirtualBox to package as a base box (VirtualBox Only) 在VirtualBox中要打包为基本box(仅适用于VirtualBox)的虚拟机的名称 --output NAME Name of the file to output 输出的文件的名称 --include FILE,FILE.. Comma separated additional files to package with the box 逗号分隔要打包的附加文件 --vagrantfile FILE Vagrantfile to package with the box 和box一起打包的Vagrantfile文件 -h, --help Print this help打印帮助信息
⚠️一个常见的误解是:
--vagrantfile选项将打包一个在此box中使用vagrant init时使用的vagrantfile文件。事实并非如此。相反,在使用该box时,vagrantfile文件将作为vagrant加载过程的一部分来被加载和读取。要了解更多信息,请阅读Vagrantfile load order内容。