Skip to content

image/manifest: accept OCI media types in Docker schema2 manifests#978

Open
lumincui wants to merge 1 commit into
podman-container-tools:mainfrom
SoTALab-ai:support-oci-media-types-in-docker-schema2
Open

image/manifest: accept OCI media types in Docker schema2 manifests#978
lumincui wants to merge 1 commit into
podman-container-tools:mainfrom
SoTALab-ai:support-oci-media-types-in-docker-schema2

Conversation

@lumincui

@lumincui lumincui commented Jul 9, 2026

Copy link
Copy Markdown

What

Accept OCI image config and layer media types when validating Docker schema 2 manifests in go.podman.io/image/v5/manifest.

This allows Schema2FromManifest / SupportedSchema2MediaType to handle Docker schema2 manifests with OCI descriptor media types, including application/vnd.oci.image.layer.v1.tar+gzip.

Why

Some registries return Docker schema2 manifests whose config/layer descriptors use OCI media types. Today those fail before copy/inspection can proceed, for example through skopeo copy --all:

unsupported docker v2s2 media type: "application/vnd.oci.image.layer.v1.tar+gzip"

Fixes #977. This replaces the PR that was first opened against the migrated containers/image repo: containers/image#2973.

Testing

$ docker run --rm -v "$PWD":/src -v ~/.cache/go-mod:/go/pkg/mod -v ~/.cache/go-build:/root/.cache/go-build -w /src/image golang:1.25 sh -lc 'timeout 420 /usr/local/go/bin/go test ./manifest -run TestSupportedSchema2MediaType -count=1 -v'
=== RUN   TestSupportedSchema2MediaType
--- PASS: TestSupportedSchema2MediaType (0.00s)
PASS
ok  	go.podman.io/image/v5/manifest	0.002s

Also verified the same code path in a patched skopeo v1.23.0 build during registry mirroring: manifests with OCI layer media types copied successfully after this change.

@mtrmac mtrmac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per #977:

Images with mixed MIME types are invalid, and have always been invalid. This code has been rejecting them since 2019, and with every passing month the case for accepting them grows weaker.

So the first recommendation must be to fix the producer, and relaxing these checks would, by now, need an exceptionally strong argument that these images are 1) widespread in the ecosystem and 2) unlikely to be fixed.


https://github.com/podman-container-tools/container-libs/blob/main/CONTRIBUTING.md#sign-your-prs please, we can’t really even look at code submissions with unclear copyright status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

image Related to "image" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker schema2 manifests with OCI layer media types are rejected

2 participants