Skip to content

Would like a way to determine if two Platforms are compatible #269

@nfachan

Description

@nfachan

This is on ARM64.

I have a Platform object that I got from Platform::default().

I have a list of Descriptors that I got from the manifests() function on the index for docker://alpine.

I'm trying to find an image that I can run on the current Platform. My current code just does a strict equality check on the two Platforms. This fails because the alpine container has the "v8" variant set.

I can obviously fix this by stripping off variants, but I would like a way to do this the correct way.

One way to do this would be to have "normalize" functions, like this: https://github.com/containerd/containerd/blob/v1.4.3/platforms/database.go#L83
I could normalize both Platforms and use strict equality checking.

I think a better way would be to have a method on Platform like can_be_run_on, or can_run, that takes another Platform.

I'm happy to provide a PR, but would like some input on the preferred direction before I do so.

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