applecontainer

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

package applecontainer implements helper functions and types for use with apple's container library. See https://github.com/apple/container for more information about how to install it and how it works.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerSvc

type ContainerSvc struct{}
var Containers ContainerSvc

Containers is a service interface to interact with apple containers.

func (*ContainerSvc) Create

func (c *ContainerSvc) Create(ctx context.Context, opts *options.CreateContainer, imageName string, initArgs []string) (string, error)

Create creates a new container with the given options, name and init args. It returns the ID of the new container instance.

func (*ContainerSvc) Delete

func (c *ContainerSvc) Delete(ctx context.Context, opts *options.DeleteContainer, id string) (string, error)

Delete deletes a container instance with a given ID. It returns the delete command output, or an error.

func (*ContainerSvc) Exec

func (c *ContainerSvc) Exec(ctx context.Context, opts *options.ExecContainer, containerID, command string, env []string, cmdArgs ...string) (string, error)

func (*ContainerSvc) ExecStream

func (c *ContainerSvc) ExecStream(ctx context.Context, opts *options.ExecContainer, containerID, command string, env []string, stdin io.Reader, stdout, stderr io.Writer, cmdArgs ...string) (func() error, error)

ExecStream executes a command in a running container instance, with stdio streams.

func (*ContainerSvc) Export

func (c *ContainerSvc) Export(ctx context.Context, opts *options.ExportContainer, id string) (string, error)

func (*ContainerSvc) Inspect

func (c *ContainerSvc) Inspect(ctx context.Context, id ...string) ([]types.Container, error)

Inspect returns details about the requested container IDs, or an error.

func (*ContainerSvc) Kill

func (c *ContainerSvc) Kill(ctx context.Context, opts *options.KillContainer, id ...string) (string, error)

Kill kills containers

func (*ContainerSvc) List

func (c *ContainerSvc) List(ctx context.Context) ([]types.Container, error)

List returns all containers, or an error.

func (*ContainerSvc) Logs

func (c *ContainerSvc) Logs(ctx context.Context, opts *options.ContainerLogs, id string) (io.ReadCloser, func() error, error)

Logs returns an io.ReadCloser for streaming log output and a wait func that blocks on the command's completion, or an error.

func (*ContainerSvc) Run

func (c *ContainerSvc) Run(ctx context.Context, opts *options.RunContainer, imageName, command string, env []string, stdin io.Reader, stdout, stderr io.Writer, cmdArgs ...string) (func() error, error)

Run runs a command in a new container instance based on the given image.

func (*ContainerSvc) Start

func (c *ContainerSvc) Start(ctx context.Context, opts *options.StartContainer, id string) (string, error)

Start starts a container instance with a given ID. It returns the start command output, or an error.

func (*ContainerSvc) Stats

func (c *ContainerSvc) Stats(ctx context.Context, id ...string) ([]types.ContainerStats, error)

func (*ContainerSvc) Stop

func (c *ContainerSvc) Stop(ctx context.Context, opts *options.StopContainer, id string) (string, error)

Stop stops a container instance with a given ID. It returns the stop command output, or an error.

type ImagesSvc

type ImagesSvc struct{}
var Images ImagesSvc

Images is a service interface to interact with apple container images.

func (*ImagesSvc) Inspect

func (i *ImagesSvc) Inspect(ctx context.Context, name string) ([]*types.ImageManifest, error)

Inspect returns details about the image with the given name, or an error.

func (*ImagesSvc) List

func (i *ImagesSvc) List(ctx context.Context) ([]types.ImageEntry, error)

List returns all images, or an error.

func (*ImagesSvc) Pull

func (i *ImagesSvc) Pull(ctx context.Context, name string, w io.Writer) (func() error, error)

Pull pulls the image with the given name and returns a wait func to release the cmd resources, or returns an error. It runs the command under a PTY so the 'container' subprocess sees a TTY and emits live progress output. All subprocess output is copied to w. The returned wait func is idempotent.

type NetworkSvc

type NetworkSvc struct{}
var Network NetworkSvc

Network is a service interface to interact with the apple container system.

func (*NetworkSvc) Create

func (s *NetworkSvc) Create(ctx context.Context, name string) (string, error)

Create creates a network.

func (*NetworkSvc) Delete

func (s *NetworkSvc) Delete(ctx context.Context, name string) (string, error)

Delete deletes a network.

func (*NetworkSvc) Inspect

func (s *NetworkSvc) Inspect(ctx context.Context, name string) ([]types.Network, error)

Inspect inspects a network.

func (*NetworkSvc) List

func (s *NetworkSvc) List(ctx context.Context) ([]types.Network, error)

List lists networks.

type SystemSvc

type SystemSvc struct{}
var System SystemSvc

System is a service interface to interact with the apple container system.

func (*SystemSvc) DNSCreate

func (s *SystemSvc) DNSCreate(ctx context.Context, domain string) error

DNSCreate adds a new local dns domain to the container system.

func (*SystemSvc) DNSList

func (s *SystemSvc) DNSList(ctx context.Context) ([]string, error)

DNSList lists the container system's dns domains, or an error.

func (*SystemSvc) Logs

func (s *SystemSvc) Logs(ctx context.Context, opts *options.SystemLogs) (io.ReadCloser, func() error, error)

Logs returns an io.ReadCloser for streaming log output and a wait func that blocks on the command's completion, or an error.

func (*SystemSvc) PropertyGet

func (s *SystemSvc) PropertyGet(ctx context.Context, id string) (string, error)

PropertyGet gets a container system property value.

func (*SystemSvc) PropertyList

func (s *SystemSvc) PropertyList(ctx context.Context) ([]types.SystemProperty, error)

PropertyList returns a slice of system property values, or an error.

func (*SystemSvc) PropertySet

func (s *SystemSvc) PropertySet(ctx context.Context, id, value string) error

PropertySet sets a container system property value.

func (*SystemSvc) Start

func (s *SystemSvc) Start(ctx context.Context, opts *options.SystemStart) (string, error)

Start starts the container system. It returns the output of the command, or an error.

func (*SystemSvc) Status

func (s *SystemSvc) Status(ctx context.Context, opts *options.SystemStatus) (string, error)

Status returns the output of `container system status`, or an error.

func (*SystemSvc) Stop

func (s *SystemSvc) Stop(ctx context.Context, opts *options.SystemStop) (string, error)

Stop stops the container system. It returns the output of the command, or an error.

func (*SystemSvc) Version

func (s *SystemSvc) Version(ctx context.Context) (string, error)

Version returns the version string for the "container" command, or an error.

Directories

Path Synopsis
package options defines structs for the flagsets passed to various `container` commands.
package options defines structs for the flagsets passed to various `container` commands.
package types defines structs for unmashaling the output from various `container` commands.
package types defines structs for unmashaling the output from various `container` commands.

Jump to

Keyboard shortcuts

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