mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-10 02:45:44 +00:00
Make sure buildah uses the new network stack. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
24 lines
664 B
Go
24 lines
664 B
Go
package util
|
|
|
|
import (
|
|
"github.com/containers/common/libimage"
|
|
"github.com/containers/image/v5/types"
|
|
"github.com/containers/storage"
|
|
)
|
|
|
|
// LookupImage returns *Image to corresponding imagename or id
|
|
func LookupImage(ctx *types.SystemContext, store storage.Store, image string) (*libimage.Image, error) {
|
|
systemContext := ctx
|
|
if systemContext == nil {
|
|
systemContext = &types.SystemContext{}
|
|
}
|
|
runtime, err := libimage.RuntimeFromStore(store, &libimage.RuntimeOptions{SystemContext: systemContext})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
localImage, _, err := runtime.LookupImage(image, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return localImage, nil
|
|
}
|