containerbackend

package
v0.110.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: AGPL-3.0 Imports: 32 Imported by: 0

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")
)
View Source
var ErrPodman = errors.New("Podman error")

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)

func NewDocker

func NewDocker() (ContainerBackend, error)

func NewPodman

func NewPodman() (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 (*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 {
	// contains filtered or unexported fields
}

func (*Podman) Close

func (backend *Podman) Close() error

func (*Podman) ContainerCreate

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

func (*Podman) ContainerDelete

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

func (*Podman) ContainerLogs added in v0.35.0

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

func (*Podman) ContainerStart

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

func (*Podman) ContainerWait

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

func (*Podman) ImageBuild

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

func (*Podman) ImageDelete added in v0.21.0

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

func (*Podman) ImageInspect

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

func (*Podman) ImagePull

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

func (*Podman) ImagePush added in v0.21.0

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

func (*Podman) SystemInfo

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

func (*Podman) VolumeCreate

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

func (*Podman) VolumeDelete

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

func (*Podman) VolumeInspect

func (backend *Podman) VolumeInspect(ctx context.Context, name string) 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