runtime

package
v0.6.11 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoRuntimeAvailable = errors.New("no container runtime (docker or containerd) available")
	ErrImageNotFound      = errors.New("image not found")
)

Functions

This section is empty.

Types

type ContainerdRuntime

type ContainerdRuntime struct {
	// contains filtered or unexported fields
}

func NewContainerdRuntime

func NewContainerdRuntime() (*ContainerdRuntime, error)

func (*ContainerdRuntime) Close

func (c *ContainerdRuntime) Close() error

func (*ContainerdRuntime) GetImage

func (c *ContainerdRuntime) GetImage(ctx context.Context, ref string) (*ImageInfo, error)

func (*ContainerdRuntime) GetImageWithPlatform added in v0.3.1

func (c *ContainerdRuntime) GetImageWithPlatform(ctx context.Context, ref, platform string) (*ImageInfo, error)

func (*ContainerdRuntime) LoadImage

func (c *ContainerdRuntime) LoadImage(ctx context.Context, inputPath string) error

func (*ContainerdRuntime) LoadImageFromReader

func (c *ContainerdRuntime) LoadImageFromReader(ctx context.Context, r io.Reader) error

func (*ContainerdRuntime) Name

func (c *ContainerdRuntime) Name() string

func (*ContainerdRuntime) SaveImage

func (c *ContainerdRuntime) SaveImage(ctx context.Context, ref, outputPath string) error

type DockerRuntime

type DockerRuntime struct{}

func NewDockerRuntime

func NewDockerRuntime() (*DockerRuntime, error)

func (*DockerRuntime) Close

func (d *DockerRuntime) Close() error

func (*DockerRuntime) GetImage

func (d *DockerRuntime) GetImage(ctx context.Context, ref string) (*ImageInfo, error)

func (*DockerRuntime) GetImageWithPlatform added in v0.3.1

func (d *DockerRuntime) GetImageWithPlatform(ctx context.Context, ref, platform string) (*ImageInfo, error)

func (*DockerRuntime) LoadImage

func (d *DockerRuntime) LoadImage(ctx context.Context, inputPath string) error

func (*DockerRuntime) LoadImageFromReader

func (d *DockerRuntime) LoadImageFromReader(ctx context.Context, r io.Reader) error

func (*DockerRuntime) Name

func (d *DockerRuntime) Name() string

func (*DockerRuntime) SaveImage

func (d *DockerRuntime) SaveImage(ctx context.Context, ref, outputPath string) error

type ImageInfo

type ImageInfo struct {
	Reference string
	ID        string
	Layers    []LayerInfo
	RepoTags  []string
}

ImageInfo contains essential image information

type LayerInfo

type LayerInfo struct {
	Digest    string
	Size      int64
	MediaType string
	Exists    bool
}

LayerInfo contains information about a layer

type Runtime

type Runtime interface {
	// Name returns the runtime name (docker, containerd, etc.)
	Name() string

	// GetImage retrieves image information
	GetImage(ctx context.Context, ref string) (*ImageInfo, error)

	// GetImageWithPlatform retrieves image information for a specific platform
	// If the image doesn't exist locally, it will be pulled for the specified platform
	GetImageWithPlatform(ctx context.Context, ref, platform string) (*ImageInfo, error)

	// SaveImage saves an image to a file
	SaveImage(ctx context.Context, ref, outputPath string) error

	// LoadImage loads an image from a file
	LoadImage(ctx context.Context, inputPath string) error

	// LoadImageFromReader loads an image from a reader
	LoadImageFromReader(ctx context.Context, r io.Reader) error

	// Close closes the runtime client
	Close() error
}

Runtime represents a container runtime interface

func DetectRuntime

func DetectRuntime() (Runtime, error)

DetectRuntime tries to detect available container runtime

Jump to

Keyboard shortcuts

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