docker

package
v0.0.0-...-5e04caf Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package docker implements a container manager for docker orchestration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager is a docker container orchestration manager.

func New

func New(cli docker) *Manager

New builds a new docker manager given a docker client.

func (*Manager) ContainerList

func (m *Manager) ContainerList(ctx context.Context, all bool, limit int32, srv options.ListContainerStreamer, opts ...options.Option) error

ContainerList lists the containers present on the target.

func (*Manager) ContainerLogs

func (m *Manager) ContainerLogs(ctx context.Context, instance string, srv options.LogStreamer, opts ...options.Option) error

ContainerLogs fetches the logs from a container. It can optionally follow the logs and send them back to the client.

func (*Manager) ContainerPull

func (m *Manager) ContainerPull(ctx context.Context, image, tag string, opts ...options.Option) error

ContainerPull pull a container from a registry to this containerz server. Based on the options specified it can tag the container, stream responses to the client, and perform registry authentication.

func (*Manager) ContainerPush

func (m *Manager) ContainerPush(ctx context.Context, file *os.File, opts ...options.Option) (string, string, error)

ContainerPush pushes the container file to the containerz server. It can optionally tag the container, otherwise it will use the name and tag provided in the file.

func (*Manager) ContainerRemove

func (m *Manager) ContainerRemove(ctx context.Context, image, tag string, opts ...options.Option) error

ContainerRemove removes an image provided it is not related to a running container. Otherwise, it returns an error.

func (*Manager) ContainerStart

func (m *Manager) ContainerStart(ctx context.Context, image, tag, cmd string, opts ...options.Option) (string, error)

ContainerStart starts a container provided the image exists and that the ports requested are not currently in use. TODO(alshabib) consider adding restart policy to containerz proto

func (*Manager) ContainerStop

func (m *Manager) ContainerStop(ctx context.Context, instance string, opts ...options.Option) error

ContainerStop stops a container. If the Force option is set and a timeout is specified in the context, the contains if forcefully terminated after that timeout. If the Force option is set but no timeout is provided the container's StopTimeout value is used, if set, otherwise the engine default. If the Force option is not set, no forceful termination is performed.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start starts a docker session to the host

func (*Manager) Stop

func (m *Manager) Stop(ctx context.Context) error

Stop closes the connection to the docker server.

func (*Manager) VolumeCreate

func (m *Manager) VolumeCreate(ctx context.Context, name string, driver cpb.Driver, opts ...options.Option) (string, error)

VolumeCreate creates a volume with the provided name using the driver specified. The driver default to LOCAL if it is not specified. The name is autogenerated by the target if it is empty.

func (*Manager) VolumeList

func (m *Manager) VolumeList(ctx context.Context, srv options.ListVolumeStreamer, opts ...options.Option) error

VolumeList lists the volumes present on the target.

func (*Manager) VolumeRemove

func (m *Manager) VolumeRemove(ctx context.Context, name string, opts ...options.Option) error

VolumeRemove removes a volume.

type Vacuum

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

Vacuum cleans a docker container runtime.

func NewJanitor

func NewJanitor(cli docker) *Vacuum

NewJanitor creates a new docker janitor.

func (*Vacuum) Start

func (j *Vacuum) Start(ctx context.Context)

Start instructs the janitor to start working

func (*Vacuum) Stop

func (j *Vacuum) Stop(ctx context.Context)

Stop instructs to janitor to take a rest.

Jump to

Keyboard shortcuts

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