Documentation ¶
Index ¶
- Constants
- Variables
- func NewSubnetManager() (*subnetManager, error)
- type Client
- func (c Client) ContainerCreate(ctx context.Context, image string, opts ContainerCreateOptions) (container.ContainerCreateCreatedBody, error)
- func (c Client) ContainerExec(ctx context.Context, ID string, command string) error
- func (c Client) ContainerInspect(ctx context.Context, ID string) (types.ContainerJSON, error)
- func (c Client) ContainerRemove(ctx context.Context, ID string) error
- func (c Client) ContainerStart(ctx context.Context, ID string) error
- func (c Client) ContainerStop(ctx context.Context, ID string) error
- func (c Client) ImagePull(ctx context.Context, image string, options ImagePullOptions) error
- func (c Client) NetworkConnect(ctx context.Context, networkID, containerID string) error
- func (c Client) NetworkCreate(ctx context.Context, name string, opts NetworkCreateOptions) (string, error)
- func (c Client) NetworkRemove(ctx context.Context, ID string) error
- func (c *Client) RegistryLogin(ctx context.Context, auth types.AuthConfig) error
- func (c *Client) Stats(ctx context.Context, opts types.ContainerListOptions) ([]*ContainerStats, error)
- type ContainerCreateOptions
- type ContainerStats
- type ImagePullOptions
- type NetworkCreateOptions
- type Opt
Constants ¶
const ( CreatedContainerManifestKey = "CreatedContainer" StartedContainerManifestKey = "StartedContainer" StoppedContainerManifestKey = "StoppedContainer" RemovedContainerManifestKey = "RemovedContainer" )
resource tags available in the manifest
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.
const SubnetDataFile = "subnet.dat"
SubnetDataFile is the name of the file that stores created subnets.
Variables ¶
var ( ErrNoAvailableSubnet = errors.New("no available subnet") ErrSubnetAlreadyAllocated = errors.New("subnet already allocated") )
related errors
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 (Client) ContainerCreate ¶
func (c Client) ContainerCreate(ctx context.Context, image string, opts ContainerCreateOptions) (container.ContainerCreateCreatedBody, error)
ContainerCreate creates a container
func (Client) ContainerExec ¶
func (Client) ContainerInspect ¶
func (Client) ContainerRemove ¶
ContainerRemove removes a container
func (Client) ContainerStart ¶
ContainerStart starts a container
func (Client) ContainerStop ¶
ContainerStop stops a container
func (Client) NetworkConnect ¶
func (Client) NetworkCreate ¶
func (*Client) RegistryLogin ¶
func (*Client) Stats ¶
func (c *Client) Stats(ctx context.Context, opts types.ContainerListOptions) ([]*ContainerStats, error)
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.