docker

package
v0.0.0-...-24327e5 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 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.

Deprecated - use RemoveImage instead.

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.

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) ContainerUpdate

func (m *Manager) ContainerUpdate(ctx context.Context, instance, image, tag, cmd string, async bool, opts ...options.Option) (string, error)

ContainerUpdate updates a running container to the image specified in the request. By default the operation is synchronous which means that the request will only return once the container has either been successfully updated or the update has failed. If the client requests an asynchronous update then the server must perform all validations (e.g. does the requested image exist on the system or does the instance name exist) and return to the client and the update happens asynchronously. It is up to the client to check if the update actually updates the container to the requested version or not. In both synchronous and asynchronous mode, the update process is a break-before-make process as resources bound to the old container must be released prior to launching the new container. If the update fails, the server must restore the previous version of the container. This can either be a start of the previous container or by starting a new container with the old image. It must use the provided StartContainerRequest provided in the params field. If a container exists but is not running should still upgrade the container and start it. The client should only depend on the client being restarted. Any ephemeral state (date written to memory or the filesystem) cannot be depended upon. In particular, the contents of the filesystem are not guaranteed during a rollback.

func (*Manager) ImageList

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

ImageList lists the images present on the target.

func (*Manager) ImageRemove

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

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

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