ubuntu - Vagrant 自定义框 metadata.json 文件

标签 ubuntu vagrant virtualbox vagrant-provision

我有一个名为 package.box 的自定义框。尝试 vagrant up, vagrant box add 时出现此错误。我创建了一个具有不同配置但没有成功的 metadata.json 文件。我不明白这条消息。我使用 virtualbox 进行配置。

我不理解他们网站上有关 metadata.json 文件的文档。

The "metadata.json" file for the box 'package.box' was not found.
Boxes require this file in order for Vagrant to determine the
provider it was made for. If you made the box, please add a
"metadata.json" file to it. If someone else made the box, please
notify the box creator that the box is corrupt. Documentation for
box file format can be found at the URL below:
https://www.vagrantup.com/docs/boxes/format.html

package.box 位于空目录中。在它旁边我放了这个 metadata.json 文件:

{
    "description": "long box description",
    "short_description": "short box description",
    "name": "company/developer-environment",
    "versions": [{
        "version": "1",
        "status": "active",
        "description_html": "<p>Dev Environment</p>",
        "description_markdown": "Dev Environment",
        "providers": [{
            "name": "virtualbox",
            "url": "./package.box"
        }]
    }]
}

我用的是ubuntu 16.04系统,vagrant 1.8.5,virtualbox 5.0.26。

最佳答案

package.box 文件是您 VM 的 zip 文件,metadata.json 文件不能在 package.box 文件旁边,而是在其中。

因此在打包之前将元数据文件存储在 VM 文件旁边,例如

.
|-- box-disk1.vmdk
|-- box.ovf
|-- metadata.json

因此,当您运行 vagrant package 时,它会将元数据文件作为 box 文件的一部分。

关于ubuntu - Vagrant 自定义框 metadata.json 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38598516/

相关文章:

Android 4.3 与 Genymotion uvesafb : failed to execute/sbin/v86d

Vagrant:如何将文件夹从访客同步回主机?

ubuntu - 傀儡/Vagrant : Unable to access LAMP VM with IP address

c - Bluez Code 无法检测到蓝牙设备,但设置可以

python - 在ubuntu 14.04上安装wxpython

windows - 指定了 vagrant 无效选项

ubuntu - 无法从主机操作系统访问 Vagrant VM 中的 Elasticsearch 2.0

linux - 密码安装失败 : usermod www-data is currently used by process 875

mysql - Ansible 没有安装最新版本的 Mysql 5.7

virtual-machine - 在虚拟机中运行真实的 "Bios Setup"