Skip to content

feat: add multi-platform OCI image support#548

Open
jasonpaulos wants to merge 3 commits into
anchore:mainfrom
jasonpaulos:multiplatform-oci
Open

feat: add multi-platform OCI image support#548
jasonpaulos wants to merge 3 commits into
anchore:mainfrom
jasonpaulos:multiplatform-oci

Conversation

@jasonpaulos

@jasonpaulos jasonpaulos commented Mar 19, 2026

Copy link
Copy Markdown

Add support to OCI directory image provider for multi-platform OCI images.

Similar to registry images, the user-provided platform is used to select the correct image, unless there is only 1 image available, in which case it will be selected regardless of platform.

I view this as an enhancement, not a breaking change, since this doesn't change any existing behavior outside of cases which would previously fail.

Unit and integration tests added to verify functionality.

This fixes #175 and anchore/syft#1545 and addresses part of anchore/syft#1683. To clarify, this doesn't add support for scanning multiple platforms simultaneously, but it does allow stereoscope & syft to operate on a single image within a multi-platform OCI image, which is currently not possible.

Signed-off-by: Jason Paulos <jasonpaulos@users.noreply.github.com>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This file just contains helper functions moved from registry_provider.go


// NewDirectoryProviderWithPlatform creates a new provider instance for the specific image already at the given path,
// with the given platform information to use when loading a multiplatform image.
func NewDirectoryProviderWithPlatform(tmpDirGen *file.TempDirGenerator, path string, platform *image.Platform) image.Provider {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I added a new constructor to avoid a potential breaking change on the existing one. Let me know if that's not a concern


indexManifest, err := index.IndexManifest()
if err != nil {
if _, err := index.IndexManifest(); err != nil {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I kept this check and layout.FromPath here even though their results aren't used to keep the error messages the same in these failures

Signed-off-by: Jason Paulos <jasonpaulos@users.noreply.github.com>
@jasonpaulos

Copy link
Copy Markdown
Author

@kzantow @wagoodman just checking in on this PR. Let me know if this is something you're open to accepting of if there's additional changes you need to see

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for image indexes with multiple manifests

1 participant