runtime

package
v0.0.0-...-2759aa6 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreatedContainerManifestKey = "CreatedContainer"
	StartedContainerManifestKey = "StartedContainer"
	StoppedContainerManifestKey = "StoppedContainer"
	RemovedContainerManifestKey = "RemovedContainer"
)

resource tags available in the manifest

View Source
const Store = datadir.Store("subnets")

Store is the unique name of the subnet store It will be located under the data directory and must absolutely be unique Changing it is a major breaking change.

View Source
const SubnetDataFile = "subnet.dat"

SubnetDataFile is the name of the file that stores created subnets.

Variables

View Source
var (
	ErrNoAvailableSubnet      = errors.New("no available subnet")
	ErrSubnetAlreadyAllocated = errors.New("subnet already allocated")
)

related errors

View Source
var DefaultSubnetBlocks = []iplib.Net4{
	iplib.NewNet4(net.IPv4(10, 0, 0, 0), 8),
	iplib.NewNet4(net.IPv4(172, 16, 0, 0), 12),
	iplib.NewNet4(net.IPv4(192, 168, 0, 0), 16),
}

DefaultSubnetBlocks is the list of private ipv4 blocks. It respects https://datatracker.ietf.org/doc/html/rfc1918. It contains the following blocks: - 10.0.0.0/8 - 172.16.0.0/12 - 192.168.0.0/16

Functions

func NewSubnetManager

func NewSubnetManager() (*subnetManager, error)

NewSubnetManager creates a new subnet manager.

Types

type Client

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

Client is used as a proxy to interact with the underlying Docker client. It is mainly used to log actions performed by the daemon.

func NewClient

func NewClient(opts ...Opt) (*Client, error)

NewClient creates a new docker client

func (Client) ContainerCreate

ContainerCreate creates a container

func (Client) ContainerExec

func (c Client) ContainerExec(ctx context.Context, ID string, command string) error

func (Client) ContainerInspect

func (c Client) ContainerInspect(ctx context.Context, ID string) (types.ContainerJSON, error)

func (Client) ContainerRemove

func (c Client) ContainerRemove(ctx context.Context, ID string) error

ContainerRemove removes a container

func (Client) ContainerStart

func (c Client) ContainerStart(ctx context.Context, ID string) error

ContainerStart starts a container

func (Client) ContainerStop

func (c Client) ContainerStop(ctx context.Context, ID string) error

ContainerStop stops a container

func (Client) ImagePull

func (c Client) ImagePull(ctx context.Context, image string, options ImagePullOptions) error

ImagePull pulls an image from a remote registry.

func (Client) NetworkConnect

func (c Client) NetworkConnect(ctx context.Context, networkID, containerID string) error

func (Client) NetworkCreate

func (c Client) NetworkCreate(ctx context.Context, name string, opts NetworkCreateOptions) (string, error)

func (Client) NetworkRemove

func (c Client) NetworkRemove(ctx context.Context, ID string) error

func (*Client) RegistryLogin

func (c *Client) RegistryLogin(ctx context.Context, auth types.AuthConfig) error

func (*Client) Stats

Stats returns the stats of many containers

type ContainerCreateOptions

type ContainerCreateOptions struct {
	// Name of the container
	Name string
	// Registry to pull image from, if any
	Registry *types.AuthConfig
	// Env variables to set
	Env []string

	Labels map[string]string

	Networking *network.NetworkingConfig
}

ContainerCreateOptions defines the options for creating a container

type ContainerStats

type ContainerStats struct {
	Name string
	ID   string

	MemoryUsed      uint64
	MemoryAvailable uint64
	MemoryUsage     float64 // percentage

	CPUCount       int
	CPUDelta       uint64
	CPUSystemDelta uint64
	CPUUsage       float64 // percentage
}

ContainerStats holds information about the memory and cpu usage of a container

type ImagePullOptions

type ImagePullOptions struct {
	// Auth is the authentication settings for pulling the image on a custom registry.
	Auth *types.AuthConfig
	// Listener is an optional progress listener.
	// It gets called every time, the daemon sends a progress event.
	Listener func(status string)
}

ImagePullOptions is the set of options that can be used when pulling an image.

type NetworkCreateOptions

type NetworkCreateOptions struct {
	Labels map[string]string
	IPAM   *network.IPAM
}

type Opt

type Opt func(*Client)

func WithDockerClient

func WithDockerClient(dockerClient *client.Client) Opt

Jump to

Keyboard shortcuts

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