cli icon indicating copy to clipboard operation
cli copied to clipboard

Devcontainer.Metadata Label can be a Dictionary or List

Open mason3263 opened this issue 5 months ago • 0 comments

When a devcontainer is built off an image without a devcontainer.metadata label the resulting image will have a devcontainer.metadata label that is a dictionary instead of a list(assuming there aren't any features that also append to the label). For example when I build my base image I get a config with the following labels:

  "Labels": {
        "devcontainer.metadata": "{\"remoteUser\":\"fedora\"}",
        "io.buildah.version": "1.40.1",
        "license": "MIT",
        "name": "fedora",
        "org.opencontainers.image.license": "MIT",
        "org.opencontainers.image.name": "fedora",
        "org.opencontainers.image.url": "https://fedoraproject.org/",
        "org.opencontainers.image.vendor": "Fedora Project",
        "org.opencontainers.image.version": "42",
        "vendor": "Fedora Project",
        "version": "42"
    },

After creating another image using this image as a base I get the following labels:

    "Labels": {
        "devcontainer.metadata": "[ {\"remoteUser\":\"fedora\"}, {\"remoteUser\":\"fedora\"} ]",
        "io.buildah.version": "1.40.1",
        "license": "MIT",
        "name": "fedora",
        "org.opencontainers.image.license": "MIT",
        "org.opencontainers.image.name": "fedora",
        "org.opencontainers.image.url": "https://fedoraproject.org/",
        "org.opencontainers.image.vendor": "Fedora Project",
        "org.opencontainers.image.version": "42",
        "vendor": "Fedora Project",
        "version": "42"
    },

Adding features to an image will have the same effect and create the metadata as a list. On the devcontainer website it says the devcontainer.metadata label "can contain an array of json snippets". For the devcontainer cli tool this doesn't seem to be an issue but I am using envbuilder to run my containers and if the metadata isn't a list it will cause envbuilder to crash. Based off the website I think it's fair to assume that it should always be a list but it isn't defined very well.

mason3263 avatar Aug 01 '25 02:08 mason3263