docker

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: PostgreSQL Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found error")
View Source
var ErrProcessNotFound = errors.New("matching process not found")

Functions

func BuildMount

func BuildMount(source, target string, readOnly bool) mount.Mount

func ExtractBindMountErrorMsg

func ExtractBindMountErrorMsg(err error) string

ExtractBindError extracts the bind error message from the given error if it is a bind error. Otherwise, returns an empty string.

func ExtractNetworkErrorMsg

func ExtractNetworkErrorMsg(err error) string

func ExtractPortErrorMsg

func ExtractPortErrorMsg(err error) string

ExtractPortErrorMsg extracts the port bind error message from the given error if it is a port bind or allocation error. Otherwise, returns an empty string.

func Provide

func Provide(i *do.Injector)

Types

type ContainerRunOptions

type ContainerRunOptions struct {
	Config   *container.Config
	Host     *container.HostConfig
	Net      *network.NetworkingConfig
	Platform *v1.Platform
	Name     string
}

type Docker

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

func NewDocker

func NewDocker() (*Docker, error)

func (*Docker) ContainerInspect

func (d *Docker) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)

func (*Docker) ContainerList

func (d *Docker) ContainerList(ctx context.Context, opts container.ListOptions) ([]types.Container, error)

func (*Docker) ContainerLogs

func (d *Docker) ContainerLogs(ctx context.Context, w io.Writer, containerID string, opts container.LogsOptions) error

func (*Docker) ContainerRemove

func (d *Docker) ContainerRemove(ctx context.Context, containerID string, opts container.RemoveOptions) error

func (*Docker) ContainerRun

func (d *Docker) ContainerRun(ctx context.Context, opts ContainerRunOptions) (string, error)

func (*Docker) ContainerStop

func (d *Docker) ContainerStop(ctx context.Context, containerID string, timeoutSeconds *int) error

func (*Docker) ContainerWait

func (d *Docker) ContainerWait(ctx context.Context, containerID string, condition container.WaitCondition, timeout time.Duration) error

func (*Docker) Exec

func (d *Docker) Exec(ctx context.Context, w io.Writer, containerID string, command []string) error

func (*Docker) GetContainerByLabels

func (d *Docker) GetContainerByLabels(ctx context.Context, labels map[string]string) (types.Container, error)

func (*Docker) HealthCheck

func (d *Docker) HealthCheck() common.ComponentStatus

func (*Docker) Info

func (d *Docker) Info(ctx context.Context) (system.Info, error)

func (*Docker) NetworkCreate

func (d *Docker) NetworkCreate(ctx context.Context, name string, options network.CreateOptions) (string, error)

func (*Docker) NetworkInspect

func (d *Docker) NetworkInspect(ctx context.Context, name string, options network.InspectOptions) (network.Inspect, error)

func (*Docker) NetworkRemove

func (d *Docker) NetworkRemove(ctx context.Context, networkID string) error

func (*Docker) NodeList

func (d *Docker) NodeList(ctx context.Context) ([]swarm.Node, error)

func (*Docker) ServiceDeploy

func (d *Docker) ServiceDeploy(ctx context.Context, spec swarm.ServiceSpec) (ServiceDeployResult, error)

func (*Docker) ServiceInspect

func (d *Docker) ServiceInspect(ctx context.Context, serviceID string) (swarm.Service, error)

func (*Docker) ServiceInspectByLabels

func (d *Docker) ServiceInspectByLabels(ctx context.Context, labels map[string]string) (swarm.Service, error)

func (*Docker) ServiceList

func (d *Docker) ServiceList(ctx context.Context, opts types.ServiceListOptions) ([]swarm.Service, error)

func (*Docker) ServiceRemove

func (d *Docker) ServiceRemove(ctx context.Context, serviceID string) error

func (*Docker) ServiceRestart

func (d *Docker) ServiceRestart(ctx context.Context, serviceID string, targetScale uint64, scaleTimeout time.Duration) error

func (*Docker) ServiceScale

func (d *Docker) ServiceScale(ctx context.Context, opts ServiceScaleOptions) error

func (*Docker) Shutdown

func (d *Docker) Shutdown() error

func (*Docker) TasksByServiceID

func (d *Docker) TasksByServiceID(ctx context.Context) (map[string][]swarm.Task, error)

func (*Docker) WaitForService

func (d *Docker) WaitForService(ctx context.Context, serviceID string, timeout time.Duration, previous swarm.Version) error

WaitForService waits until the given service achieves the desired state and number of tasks. The Swarm API can return stale data before the updated spec has propagated to all manager nodes, so the optional 'previous swarm.Version' parameter can be used to detect stale reads.

type NetworkInfo

type NetworkInfo struct {
	Name    string
	ID      string
	Subnet  netip.Prefix
	Gateway netip.Addr
}

func ExtractNetworkInfo

func ExtractNetworkInfo(info network.Inspect) (*NetworkInfo, error)

type ServiceDeployResult

type ServiceDeployResult struct {
	ServiceID string
	Previous  swarm.Version
}

type ServiceScaleOptions

type ServiceScaleOptions struct {
	ServiceID   string
	Scale       uint64
	Wait        bool
	WaitTimeout time.Duration
}

Jump to

Keyboard shortcuts

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