Skip to content

v1.Manifest is no longer compatible with docker #562

@vishvananda

Description

@vishvananda

I think this was intentional, but I wanted to verify since this changed between rc3 and rc4.

Now that v1.Manifest no longer has a self describing MediaType associated with it, it is incompatible with the docker layout for manifest. This means converting back and forth is a bit trickier. Given an oci manifest origManifest, converting it to docker format (so you can upload it into a v2 registry, for example), used to look like:

manifest := origManifest
manifest.mediaType = "application/vnd.docker.distribution.manifest.v2+json"
manifest.Config.MediaType = "application/vnd.docker.container.image.v1+json"
for _, l := range manifest.Layers {
    layer.MediaType =  "application/vnd.docker.image.rootfs.diff.tar.gzip"
}

Now it is necessary to wrap the manifest in a new version that has the removed field. For example:

type maybeDockerManifest struct {
    v1.Manifest
    MediaType string `json:"mediaType,omitempty"`
}
manifest := maybeDockerManifest{Manifest: origManifest}
manifest.mediaType = "application/vnd.docker.distribution.manifest.v2+json"
manifest.Config.MediaType = "application/vnd.docker.container.image.v1+json"
for _, l := range manifest.Layers {
    layer.MediaType =  "application/vnd.docker.image.rootfs.diff.tar.gzip"
}

This isn't hugely painful, but I wanted to make sure the ramifications of changing that field and breaking compatiblity are understood.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions