etudor
etudor

Reputation: 1200

Vagrant custom box metadata.json file

I have a custom box named package.box. I get this error when trying to vagrant up, vagrant box add. I created a metadata.json file with different configurations but with no luck. I don't understand this message. I use virtualbox for provisioning.

I don't understand the documentation on their website regarding metadata.json file.

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

The package.box lives in am empty directory. Next to it I put this metadata.json file:

{
    "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"
        }]
    }]
}

I use a ubuntu 16.04 system, vagrant 1.8.5, virtualbox 5.0.26.

Upvotes: 3

Views: 7703

Answers (1)

Frederic Henri
Frederic Henri

Reputation: 53703

the package.box file is a zip file of your VM, the metadata.json file must not be next the the package.box file but inside it.

so store the metadata file next to the VM file before you package the box, something like

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

so when you run vagrant package it will include the metadata file as part of the box file.

Upvotes: 4

Related Questions