diff options
author | openshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com> | 2022-07-05 10:10:41 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-05 10:10:41 +0000 |
commit | ffc8d654924b50dcf80dd6a1a1b63cd2e9d3e55e (patch) | |
tree | 8d41b9a3a775c99e6ac0a1cbdba53e5198878ab1 /pkg | |
parent | 773eead54e2e0877e92d5871625a6cc32c582d30 (diff) | |
parent | efe1176dd90ea38742c53c8588fbc83e6b9aefd6 (diff) | |
download | podman-ffc8d654924b50dcf80dd6a1a1b63cd2e9d3e55e.tar.gz podman-ffc8d654924b50dcf80dd6a1a1b63cd2e9d3e55e.tar.bz2 podman-ffc8d654924b50dcf80dd6a1a1b63cd2e9d3e55e.zip |
Merge pull request #14827 from flouthoc/specgen-run-support-manifest
specgen,run: support running container from valid manifest list using `--platform`
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/specgen/generate/container.go | 11 | ||||
-rw-r--r-- | pkg/specgen/specgen.go | 6 |
2 files changed, 16 insertions, 1 deletions
diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go index 30c759495..8fdd87adf 100644 --- a/pkg/specgen/generate/container.go +++ b/pkg/specgen/generate/container.go @@ -38,10 +38,19 @@ func getImageFromSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGen } // Need to look up image. - image, resolvedName, err := r.LibimageRuntime().LookupImage(s.Image, nil) + lookupOptions := &libimage.LookupImageOptions{ManifestList: true} + image, resolvedName, err := r.LibimageRuntime().LookupImage(s.Image, lookupOptions) if err != nil { return nil, "", nil, err } + manifestList, err := image.ToManifestList() + // only process if manifest list found otherwise expect it to be regular image + if err == nil { + image, err = manifestList.LookupInstance(ctx, s.ImageArch, s.ImageOS, s.ImageVariant) + if err != nil { + return nil, "", nil, err + } + } s.SetImage(image, resolvedName) inspectData, err := image.Inspect(ctx, nil) if err != nil { diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go index 79e20667b..42b89ece1 100644 --- a/pkg/specgen/specgen.go +++ b/pkg/specgen/specgen.go @@ -103,6 +103,12 @@ type ContainerBasicConfig struct { // RawImageName is the user-specified and unprocessed input referring // to a local or a remote image. RawImageName string `json:"raw_image_name,omitempty"` + // ImageOS is the user-specified image OS + ImageOS string `json:"image_os,omitempty"` + // ImageArch is the user-specified image architecture + ImageArch string `json:"image_arch,omitempty"` + // ImageVariant is the user-specified image variant + ImageVariant string `json:"image_variant,omitempty"` // RestartPolicy is the container's restart policy - an action which // will be taken when the container exits. // If not given, the default policy, which does nothing, will be used. |