engine

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerInfo

type ContainerInfo struct {
	ID      string
	Name    string
	Image   string
	State   string
	Status  string
	IP      string
	Ports   string
	Created time.Time
	Command string
}

func ParseNerdctlContainerList added in v0.4.0

func ParseNerdctlContainerList(data []byte) ([]ContainerInfo, error)

type Engine

type Engine struct {
	Binary string
}

Engine is the Apple Container CLI backend (macOS).

func New

func New(binary string) *Engine

func (*Engine) BinaryPath added in v0.4.0

func (e *Engine) BinaryPath() string

func (*Engine) ContainerExec

func (e *Engine) ContainerExec(ctx context.Context, nameOrID string, args []string, interactive bool) error

func (*Engine) ContainerInspect

func (e *Engine) ContainerInspect(ctx context.Context, nameOrID string) ([]byte, error)

func (*Engine) ContainerList

func (e *Engine) ContainerList(ctx context.Context, all bool) ([]ContainerInfo, error)

func (*Engine) ContainerLogs

func (e *Engine) ContainerLogs(ctx context.Context, nameOrID string, follow bool) error

func (*Engine) ContainerRemove

func (e *Engine) ContainerRemove(ctx context.Context, nameOrID string, force bool) error

func (*Engine) ContainerRun

func (e *Engine) ContainerRun(ctx context.Context, args []string, interactive bool) error

func (*Engine) ContainerStart

func (e *Engine) ContainerStart(ctx context.Context, nameOrID string) error

func (*Engine) ContainerStop

func (e *Engine) ContainerStop(ctx context.Context, nameOrID string) error

func (*Engine) Exec

func (e *Engine) Exec(ctx context.Context, args ...string) ([]byte, []byte, error)

func (*Engine) ExecInteractive

func (e *Engine) ExecInteractive(ctx context.Context, args ...string) error

func (*Engine) ExecStream

func (e *Engine) ExecStream(ctx context.Context, args ...string) (io.ReadCloser, error)

func (*Engine) ImageBuild

func (e *Engine) ImageBuild(ctx context.Context, args []string) error

func (*Engine) ImageList

func (e *Engine) ImageList(ctx context.Context) ([]ImageInfo, error)

func (*Engine) ImagePull

func (e *Engine) ImagePull(ctx context.Context, image string) error

func (*Engine) ImagePush

func (e *Engine) ImagePush(ctx context.Context, image string) error

func (*Engine) ImageRemove

func (e *Engine) ImageRemove(ctx context.Context, image string) error

func (*Engine) NetworkConnect

func (e *Engine) NetworkConnect(ctx context.Context, network, container string) error

func (*Engine) NetworkCreate

func (e *Engine) NetworkCreate(ctx context.Context, name string) error

func (*Engine) NetworkDisconnect

func (e *Engine) NetworkDisconnect(ctx context.Context, network, container string) error

func (*Engine) NetworkInspect

func (e *Engine) NetworkInspect(ctx context.Context, name string) ([]byte, error)

func (*Engine) NetworkList

func (e *Engine) NetworkList(ctx context.Context) ([]NetworkInfo, error)

func (*Engine) NetworkRemove

func (e *Engine) NetworkRemove(ctx context.Context, name string) error

func (*Engine) Validate

func (e *Engine) Validate() error

func (*Engine) VolumeCreate

func (e *Engine) VolumeCreate(ctx context.Context, name string) error

func (*Engine) VolumeInspect

func (e *Engine) VolumeInspect(ctx context.Context, name string) ([]byte, error)

func (*Engine) VolumeList

func (e *Engine) VolumeList(ctx context.Context) ([]VolumeInfo, error)

func (*Engine) VolumeRemove

func (e *Engine) VolumeRemove(ctx context.Context, name string) error

type ImageInfo

type ImageInfo struct {
	ID      string
	Name    string
	Tag     string
	Digest  string
	Size    string
	Created time.Time
	Arch    string
}

func ParseNerdctlImageList added in v0.4.0

func ParseNerdctlImageList(data []byte) ([]ImageInfo, error)

type InspectData

type InspectData struct {
	Raw []byte // raw JSON from `container inspect`
}

type NerdctlRuntime added in v0.4.0

type NerdctlRuntime struct {
	Binary string
}

NerdctlRuntime is the containerd/nerdctl backend (Linux).

func NewNerdctl added in v0.4.0

func NewNerdctl(binary string) *NerdctlRuntime

func (*NerdctlRuntime) BinaryPath added in v0.4.0

func (n *NerdctlRuntime) BinaryPath() string

func (*NerdctlRuntime) ContainerExec added in v0.4.0

func (n *NerdctlRuntime) ContainerExec(ctx context.Context, nameOrID string, args []string, interactive bool) error

func (*NerdctlRuntime) ContainerInspect added in v0.4.0

func (n *NerdctlRuntime) ContainerInspect(ctx context.Context, nameOrID string) ([]byte, error)

func (*NerdctlRuntime) ContainerList added in v0.4.0

func (n *NerdctlRuntime) ContainerList(ctx context.Context, all bool) ([]ContainerInfo, error)

func (*NerdctlRuntime) ContainerLogs added in v0.4.0

func (n *NerdctlRuntime) ContainerLogs(ctx context.Context, nameOrID string, follow bool) error

func (*NerdctlRuntime) ContainerRemove added in v0.4.0

func (n *NerdctlRuntime) ContainerRemove(ctx context.Context, nameOrID string, force bool) error

func (*NerdctlRuntime) ContainerRun added in v0.4.0

func (n *NerdctlRuntime) ContainerRun(ctx context.Context, args []string, interactive bool) error

func (*NerdctlRuntime) ContainerStart added in v0.4.0

func (n *NerdctlRuntime) ContainerStart(ctx context.Context, nameOrID string) error

func (*NerdctlRuntime) ContainerStop added in v0.4.0

func (n *NerdctlRuntime) ContainerStop(ctx context.Context, nameOrID string) error

func (*NerdctlRuntime) Exec added in v0.4.0

func (n *NerdctlRuntime) Exec(ctx context.Context, args ...string) ([]byte, []byte, error)

func (*NerdctlRuntime) ExecInteractive added in v0.4.0

func (n *NerdctlRuntime) ExecInteractive(ctx context.Context, args ...string) error

func (*NerdctlRuntime) ExecStream added in v0.4.0

func (n *NerdctlRuntime) ExecStream(ctx context.Context, args ...string) (io.ReadCloser, error)

func (*NerdctlRuntime) ImageBuild added in v0.4.0

func (n *NerdctlRuntime) ImageBuild(ctx context.Context, args []string) error

func (*NerdctlRuntime) ImageList added in v0.4.0

func (n *NerdctlRuntime) ImageList(ctx context.Context) ([]ImageInfo, error)

func (*NerdctlRuntime) ImagePull added in v0.4.0

func (n *NerdctlRuntime) ImagePull(ctx context.Context, image string) error

func (*NerdctlRuntime) ImagePush added in v0.4.0

func (n *NerdctlRuntime) ImagePush(ctx context.Context, image string) error

func (*NerdctlRuntime) ImageRemove added in v0.4.0

func (n *NerdctlRuntime) ImageRemove(ctx context.Context, image string) error

func (*NerdctlRuntime) NetworkConnect added in v0.4.0

func (n *NerdctlRuntime) NetworkConnect(ctx context.Context, network, container string) error

func (*NerdctlRuntime) NetworkCreate added in v0.4.0

func (n *NerdctlRuntime) NetworkCreate(ctx context.Context, name string) error

func (*NerdctlRuntime) NetworkDisconnect added in v0.4.0

func (n *NerdctlRuntime) NetworkDisconnect(ctx context.Context, network, container string) error

func (*NerdctlRuntime) NetworkInspect added in v0.4.0

func (n *NerdctlRuntime) NetworkInspect(ctx context.Context, name string) ([]byte, error)

func (*NerdctlRuntime) NetworkList added in v0.4.0

func (n *NerdctlRuntime) NetworkList(ctx context.Context) ([]NetworkInfo, error)

func (*NerdctlRuntime) NetworkRemove added in v0.4.0

func (n *NerdctlRuntime) NetworkRemove(ctx context.Context, name string) error

func (*NerdctlRuntime) Validate added in v0.4.0

func (n *NerdctlRuntime) Validate() error

func (*NerdctlRuntime) VolumeCreate added in v0.4.0

func (n *NerdctlRuntime) VolumeCreate(ctx context.Context, name string) error

func (*NerdctlRuntime) VolumeInspect added in v0.4.0

func (n *NerdctlRuntime) VolumeInspect(ctx context.Context, name string) ([]byte, error)

func (*NerdctlRuntime) VolumeList added in v0.4.0

func (n *NerdctlRuntime) VolumeList(ctx context.Context) ([]VolumeInfo, error)

func (*NerdctlRuntime) VolumeRemove added in v0.4.0

func (n *NerdctlRuntime) VolumeRemove(ctx context.Context, name string) error

type NetworkInfo

type NetworkInfo struct {
	ID     string
	Name   string
	Driver string
	Scope  string
}

func ParseNerdctlNetworkList added in v0.4.0

func ParseNerdctlNetworkList(data []byte) ([]NetworkInfo, error)

type Runtime added in v0.4.0

type Runtime interface {
	// Validate checks that the backend binary exists and is usable.
	Validate() error

	// BinaryPath returns the path to the underlying runtime binary.
	BinaryPath() string

	// Low-level exec — used by API server and commands that need raw CLI access.
	Exec(ctx context.Context, args ...string) ([]byte, []byte, error)
	ExecInteractive(ctx context.Context, args ...string) error
	ExecStream(ctx context.Context, args ...string) (io.ReadCloser, error)

	// Container lifecycle
	ContainerRun(ctx context.Context, args []string, interactive bool) error
	ContainerList(ctx context.Context, all bool) ([]ContainerInfo, error)
	ContainerStop(ctx context.Context, nameOrID string) error
	ContainerStart(ctx context.Context, nameOrID string) error
	ContainerRemove(ctx context.Context, nameOrID string, force bool) error
	ContainerExec(ctx context.Context, nameOrID string, args []string, interactive bool) error
	ContainerLogs(ctx context.Context, nameOrID string, follow bool) error
	ContainerInspect(ctx context.Context, nameOrID string) ([]byte, error)

	// Images
	ImagePull(ctx context.Context, image string) error
	ImagePush(ctx context.Context, image string) error
	ImageList(ctx context.Context) ([]ImageInfo, error)
	ImageRemove(ctx context.Context, image string) error
	ImageBuild(ctx context.Context, args []string) error

	// Networks
	NetworkCreate(ctx context.Context, name string) error
	NetworkList(ctx context.Context) ([]NetworkInfo, error)
	NetworkRemove(ctx context.Context, name string) error
	NetworkConnect(ctx context.Context, network, container string) error
	NetworkDisconnect(ctx context.Context, network, container string) error
	NetworkInspect(ctx context.Context, name string) ([]byte, error)

	// Volumes
	VolumeCreate(ctx context.Context, name string) error
	VolumeList(ctx context.Context) ([]VolumeInfo, error)
	VolumeRemove(ctx context.Context, name string) error
	VolumeInspect(ctx context.Context, name string) ([]byte, error)
}

Runtime is the interface that all container backends must implement. The current Engine struct (Apple Container CLI) implements this interface. Future backends (e.g., NerdctlRuntime) will also implement it.

func DetectRuntime added in v0.4.0

func DetectRuntime(binaryOverride string) (Runtime, error)

DetectRuntime auto-detects the appropriate container runtime for the current platform. On macOS it uses Apple's container CLI, on Linux it uses nerdctl (containerd).

type VolumeInfo

type VolumeInfo struct {
	Name       string
	Driver     string
	Mountpoint string
	Created    time.Time
}

func ParseNerdctlVolumeList added in v0.4.0

func ParseNerdctlVolumeList(data []byte) ([]VolumeInfo, error)

Jump to

Keyboard shortcuts

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