container

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LabelManagedBy is the label used to identify containers managed by dbctl
	LabelManagedBy = "managed_by"
	// LabelDBctl is the value of the managed_by label
	LabelDBctl = "dbctl"
)
View Source
const (
	// LabelType is the label used to identify the type of database
	LabelType = "dbctl_type"
	// LabelCustom is the label used to identify a database
	LabelCustom = "dbctl_custom"
)

Variables

This section is empty.

Functions

func CreateContainer added in v0.3.0

func CreateContainer(ctx context.Context, params CreateRequest) (string, error)

CreateContainer creates a container

func CreateExec added in v0.5.0

func CreateExec(ctx context.Context, containerID string, cmd []string) (string, error)

func PullImage added in v0.3.0

func PullImage(ctx context.Context, image string) error

PullImage pulls a docker image

func RemoveContainer added in v0.3.0

func RemoveContainer(ctx context.Context, id string) error

RemoveContainer removes a container by id

func RunExec added in v0.5.0

func RunExec(ctx context.Context, containerID string, cmd []string) (string, error)

func StartContainer added in v0.3.0

func StartContainer(ctx context.Context, id string) error

StartContainer starts a container by id

func StartExec added in v0.5.0

func StartExec(ctx context.Context, execID string) (string, error)

func TerminateByID added in v0.2.0

func TerminateByID(ctx context.Context, id string) error

TerminateByID stops and removes a container by id

Types

type Container added in v0.1.9

type Container struct {
	ID     string
	Name   string
	Labels map[string]string
}

func List added in v0.1.12

func List(ctx context.Context, labels map[string]string) ([]*Container, error)

List lists all containers with the given labels managed by dbctl

func Run

func Run(ctx context.Context, req CreateRequest) (*Container, error)

Run creates and starts a container

func (*Container) Terminate added in v0.1.9

func (c *Container) Terminate(ctx context.Context) error

Terminate stops and removes a container

type CreateRequest added in v0.3.0

type CreateRequest struct {
	Name         string
	Image        string
	ExposedPorts []string // allow specifying protocol info
	Cmd          []string
	Env          map[string]string
	Labels       map[string]string
}

type DockerExecResponse added in v0.5.0

type DockerExecResponse struct {
	ID string `json:"Id"`
}

Jump to

Keyboard shortcuts

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