ociimage

package
v4.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2023 License: BSD-3-Clause Imports: 32 Imported by: 0

Documentation

Overview

Package ociimage provides functions related to retrieving and manipulating OCI images, used in pull/push and build operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheReference

func CacheReference(ctx context.Context, sysCtx *types.SystemContext, imgCache *cache.Handle, src types.ImageReference) (types.ImageReference, digest.Digest, error)

CacheReference converts an ImageReference into a CachedImageReference to cache its blobs.

func CachedReferenceFromURI

func CachedReferenceFromURI(ctx context.Context, sysCtx *types.SystemContext, imgCache *cache.Handle, uri string) (types.ImageReference, digest.Digest, error)

CachedReferenceFromURI parses a uri-like reference to an OCI image (e.g. docker://ubuntu) into it's transport:reference combination and then returns a CachedImageReference.

func CheckPerms

func CheckPerms(rootfs string) (err error)

CheckPerms will work through the rootfs of this bundle, and find if any directory does not have owner rwX - which may cause unexpected issues for a user trying to look through, or delete a sandbox

func FetchLayout

func FetchLayout(ctx context.Context, sysCtx *types.SystemContext, imgCache *cache.Handle, imageRef, layoutDir string) (types.ImageReference, digest.Digest, error)

FetchLayout will fetch the OCI image specified by imageRef to a containers/image OCI layout in layoutDir. An ImageReference to the image that was fetched into layoutDir is returned on success. If imgCache is non-nil, and enabled, the image will be pulled through the cache.

func FixPerms

func FixPerms(rootfs string) (err error)

FixPerms will work through the rootfs of this bundle, making sure that all files and directories have permissions set such that the owner can read, modify, delete. This brings us to the situation of <=3.4

func ImageDigest

func ImageDigest(ctx context.Context, sysCtx *types.SystemContext, imgCache *cache.Handle, ref types.ImageReference) (digest.Digest, error)

ImageDigest obtains the digest of the image manifest for an ImageReference. If the ImageReference points at a multi-arch repository with an image index (manifest list), it will traverse this to retrieve the digest of the image manifest for the requested architecture specified in sysCtx.

func ParseImageRef

func ParseImageRef(imageRef string) (types.ImageReference, error)

parseImageRef parses a uri-like OCI image reference into a containers/image types.ImageReference.

func UnpackRootfs

func UnpackRootfs(ctx context.Context, layoutDir string, manifest imgspecv1.Manifest, destDir string) (err error)

UnpackRootfs extracts all of the layers of the given image manifest from an OCI layout into rootfsDir.

Types

type CachedImageReference

type CachedImageReference struct {
	types.ImageReference
	// contains filtered or unexported fields
}

CachedImageReference wraps the containers/image ImageReference type, so that operations pull through a layout holding a cache of OCI blobs.

func (*CachedImageReference) NewImage

NewImage wraps the cache's oci-layout ref to first download the real source image to the cache

func (*CachedImageReference) NewImageSource

NewImageSource wraps the cache's oci-layout ref to first download the real source image to the cache

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL