containerbackend

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 25 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	BackendTypeAuto   = "auto"
	BackendTypeDocker = "docker"
	BackendTypePodman = "podman"
)

Variables

View Source
var (
	ErrNotFound       = errors.New("not found")
	ErrDone           = errors.New("done")
	ErrNewFailed      = errors.New("failed to create container backend")
	ErrBuildFailed    = errors.New("failed to build image")
	ErrPushFailed     = errors.New("failed to push container")
	ErrNotImplemented = errors.New("unimplemented container backend method")
)

Functions

This section is empty.

Types

type ContainerBackend

type ContainerBackend interface {
	io.Closer

	ImagePull(ctx context.Context, reference string, architecture *api.Architecture) error
	ImagePush(ctx context.Context, reference string) error
	ImageBuild(ctx context.Context, tarball io.Reader, input *ImageBuildInput) (<-chan string, <-chan error)
	ImageInspect(ctx context.Context, reference string) error
	ImageDelete(ctx context.Context, reference string) error

	VolumeCreate(ctx context.Context, name string) error
	VolumeInspect(ctx context.Context, name string) error
	VolumeDelete(ctx context.Context, name string) error

	ContainerCreate(ctx context.Context, input *ContainerCreateInput, name string) (*ContainerCreateOutput, error)
	ContainerStart(ctx context.Context, id string) error
	ContainerWait(ctx context.Context, id string) (<-chan ContainerWaitResult, <-chan error)
	ContainerLogs(ctx context.Context, id string) (<-chan string, error)
	ContainerDelete(ctx context.Context, id string) error

	SystemInfo(ctx context.Context) (*SystemInfo, error)
}

func New

func New(name string) (ContainerBackend, error)

type ContainerCreateInput

type ContainerCreateInput struct {
	Image          string
	Architecture   *api.Architecture
	Entrypoint     []string
	Command        []string
	Env            map[string]string
	Mounts         []ContainerMount
	Network        string
	Resources      ContainerResources
	DisableSELinux bool
	Privileged     bool
}

type ContainerCreateOutput

type ContainerCreateOutput struct {
	ID string
}

type ContainerMount

type ContainerMount struct {
	Type     ContainerMountType
	Source   string
	Target   string
	ReadOnly bool
}

type ContainerMountType

type ContainerMountType int
const (
	MountTypeBind ContainerMountType = iota
	MountTypeVolume
)

type ContainerResources

type ContainerResources struct {
	NanoCPUs int64
	Memory   int64
}

type ContainerWaitResult

type ContainerWaitResult struct {
	StatusCode int64
	Error      string
}

type Docker

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

func NewDocker

func NewDocker(hosts ...string) (*Docker, error)

func (*Docker) Close

func (backend *Docker) Close() error

func (*Docker) ContainerCreate

func (backend *Docker) ContainerCreate(
	ctx context.Context,
	input *ContainerCreateInput,
	name string,
) (*ContainerCreateOutput, error)

func (*Docker) ContainerDelete

func (backend *Docker) ContainerDelete(ctx context.Context, id string) error

func (*Docker) ContainerLogs added in v0.35.0

func (backend *Docker) ContainerLogs(ctx context.Context, id string) (<-chan string, error)

func (*Docker) ContainerStart

func (backend *Docker) ContainerStart(ctx context.Context, id string) error

func (*Docker) ContainerWait

func (backend *Docker) ContainerWait(ctx context.Context, id string) (<-chan ContainerWaitResult, <-chan error)

func (*Docker) ImageBuild

func (backend *Docker) ImageBuild(
	ctx context.Context,
	tarball io.Reader,
	input *ImageBuildInput,
) (<-chan string, <-chan error)

func (*Docker) ImageDelete added in v0.21.0

func (backend *Docker) ImageDelete(ctx context.Context, reference string) error

func (*Docker) ImageInspect

func (backend *Docker) ImageInspect(ctx context.Context, reference string) error

func (*Docker) ImagePull

func (backend *Docker) ImagePull(ctx context.Context, reference string, architecture *api.Architecture) error

func (*Docker) ImagePush added in v0.21.0

func (backend *Docker) ImagePush(ctx context.Context, reference string) error

func (*Docker) SystemInfo

func (backend *Docker) SystemInfo(ctx context.Context) (*SystemInfo, error)

func (*Docker) VolumeCreate

func (backend *Docker) VolumeCreate(ctx context.Context, name string) error

func (*Docker) VolumeDelete

func (backend *Docker) VolumeDelete(ctx context.Context, name string) error

func (*Docker) VolumeInspect

func (backend *Docker) VolumeInspect(ctx context.Context, name string) error

type ImageBuildInput

type ImageBuildInput struct {
	Tags       []string
	Dockerfile string
	BuildArgs  map[string]string
	Pull       bool
}

type Podman

type Podman struct {
	*Docker
	// contains filtered or unexported fields
}

func NewPodman

func NewPodman() (*Podman, error)

func (*Podman) Close

func (backend *Podman) Close() error

type SystemInfo

type SystemInfo struct {
	Version          string
	TotalCPUs        int64
	TotalMemoryBytes int64
}

type Unimplemented

type Unimplemented struct{}

func (*Unimplemented) Close

func (*Unimplemented) Close() error

func (*Unimplemented) ContainerCreate

func (*Unimplemented) ContainerCreate(
	ctx context.Context,
	input *ContainerCreateInput,
	name string,
) (*ContainerCreateOutput, error)

func (*Unimplemented) ContainerDelete

func (*Unimplemented) ContainerDelete(ctx context.Context, id string) error

func (*Unimplemented) ContainerLogs added in v0.35.0

func (*Unimplemented) ContainerLogs(ctx context.Context, id string) (<-chan string, error)

func (*Unimplemented) ContainerStart

func (*Unimplemented) ContainerStart(ctx context.Context, id string) error

func (*Unimplemented) ContainerWait

func (*Unimplemented) ContainerWait(ctx context.Context, id string) (<-chan ContainerWaitResult, <-chan error)

func (*Unimplemented) ImageBuild

func (*Unimplemented) ImageBuild(
	ctx context.Context,
	tarball io.Reader,
	input *ImageBuildInput,
) (<-chan string, <-chan error)

func (*Unimplemented) ImageDelete added in v0.21.0

func (*Unimplemented) ImageDelete(ctx context.Context, reference string) error

func (*Unimplemented) ImageInspect

func (*Unimplemented) ImageInspect(ctx context.Context, reference string) error

func (*Unimplemented) ImagePull

func (*Unimplemented) ImagePull(ctx context.Context, reference string, architecture *api.Architecture) error

func (*Unimplemented) ImagePush added in v0.21.0

func (*Unimplemented) ImagePush(ctx context.Context, reference string) error

func (*Unimplemented) SystemInfo

func (*Unimplemented) SystemInfo(ctx context.Context) (*SystemInfo, error)

func (*Unimplemented) VolumeCreate

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

func (*Unimplemented) VolumeDelete

func (*Unimplemented) VolumeDelete(ctx context.Context, name string) error

func (*Unimplemented) VolumeInspect

func (*Unimplemented) VolumeInspect(ctx context.Context, name string) error

type Version added in v0.35.0

type Version struct {
	Version string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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