docker

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package docker implements a Docker-based infrastructure provider for the ctrlplane.

Index

Constants

This section is empty.

Variables

View Source
var ErrLogsNotImplemented = errors.New("docker: logs not implemented")

ErrLogsNotImplemented is returned when logs are not yet available.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Host is the Docker daemon address (e.g., unix:///var/run/docker.sock).
	Host string `env:"CP_DOCKER_HOST" json:"host"`

	// Network is the Docker network to attach containers to.
	Network string `default:"bridge" env:"CP_DOCKER_NETWORK" json:"network"`

	// Registry is the default image registry prefix.
	Registry string `env:"CP_DOCKER_REGISTRY" json:"registry,omitempty"`
}

Config holds configuration for the Docker provider.

type Option added in v1.3.0

type Option func(*Provider) error

Option configures a Docker provider.

func WithConfig added in v1.3.0

func WithConfig(cfg Config) Option

WithConfig applies all non-zero fields from a Config struct. This is useful when loading configuration from files or environment variables.

func WithHost added in v1.3.0

func WithHost(host string) Option

WithHost sets the Docker daemon address (e.g., "unix:///var/run/docker.sock").

func WithNetwork added in v1.3.0

func WithNetwork(network string) Option

WithNetwork sets the Docker network to attach containers to.

func WithRegistry added in v1.3.0

func WithRegistry(registry string) Option

WithRegistry sets the default image registry prefix.

type Provider

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

Provider is a Docker-based infrastructure provider.

func New

func New(opts ...Option) (*Provider, error)

New creates a new Docker provider with the given options. Without any options, sane defaults are used (network: "bridge").

func (*Provider) Capabilities

func (p *Provider) Capabilities() []provider.Capability

Capabilities returns the set of features this provider supports.

func (*Provider) Deploy

Deploy pushes a new release to the instance.

func (*Provider) Deprovision

func (p *Provider) Deprovision(_ context.Context, _ id.ID) error

Deprovision tears down all resources for an instance.

func (*Provider) Exec

Exec runs a command inside the instance.

func (*Provider) Info

func (p *Provider) Info() provider.ProviderInfo

Info returns metadata about this provider.

func (*Provider) Logs

Logs streams logs for the instance.

func (*Provider) Provision

Provision creates infrastructure resources for an instance.

func (*Provider) Resources

func (p *Provider) Resources(_ context.Context, _ id.ID) (*provider.ResourceUsage, error)

Resources returns current resource utilization for an instance.

func (*Provider) Restart

func (p *Provider) Restart(_ context.Context, _ id.ID) error

Restart performs a stop followed by start cycle.

func (*Provider) Rollback

func (p *Provider) Rollback(_ context.Context, _ id.ID, _ id.ID) error

Rollback reverts to a previous release.

func (*Provider) Scale

func (p *Provider) Scale(_ context.Context, _ id.ID, _ provider.ResourceSpec) error

Scale adjusts the resource allocation for an instance.

func (*Provider) Start

func (p *Provider) Start(_ context.Context, _ id.ID) error

Start starts a stopped instance.

func (*Provider) Status

func (p *Provider) Status(_ context.Context, _ id.ID) (*provider.InstanceStatus, error)

Status returns the current runtime status of an instance.

func (*Provider) Stop

func (p *Provider) Stop(_ context.Context, _ id.ID) error

Stop gracefully stops a running instance.

Jump to

Keyboard shortcuts

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