docker

package
v0.0.0-...-09eda65 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrImageNotFound is returned when the image does not exist
	ErrImageNotFound = errors.New("image not found")
)
View Source
var (
	ErrNoAvailableSubnet = errors.New("no available subnet")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	// Client is the underlying docker client
	// todo: make this private
	Client *client.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(logger *log.Logger, networkConf *Subnetter) (*Client, error)

func (Client) ContainerCreate

func (c Client) ContainerCreate(config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (string, error)

func (Client) ContainerDelete

func (c Client) ContainerDelete(containerID string) error

ContainerDelete stops and removes a container

func (Client) ContainerExec

func (c Client) ContainerExec(id string, command string) error

func (Client) ContainerStart

func (c Client) ContainerStart(id string) error

func (Client) GetContainerIP

func (c Client) GetContainerIP(id string) (string, error)

func (Client) ImagePull

func (c Client) ImagePull(i Image, handler func(event *PullEvent), registry *Registry) error

ImagePull pulls an image from a registry

func (Client) Log

func (c Client) Log(level loggy.Level, message string, fields loggy.Fields)

func (Client) NetworkConnect

func (c Client) NetworkConnect(networkID, containerID string, aliases []string) error

func (Client) NetworkCreate

func (c Client) NetworkCreate(name string, labels map[string]string) (string, error)

type Image

type Image string

Image represents a docker image name

func (Image) String

func (i Image) String() string

String returns the string representation of the image

type PullEvent

type PullEvent struct {
	// Status is the current status of the pull
	Status string `json:"status"`
}

PullEvent represents a docker image pull event

type Registry

type Registry struct {
	// Name of the registry.
	Name string `yaml:"name" json:"name"`
	// Host of the registry.
	Host string `yaml:"host" json:"host"`
	// Port of the registry.
	Port string `yaml:"port" json:"port"`
	// Username to use when authenticating with the registry.
	Username string `yaml:"username" json:"username"`
	// Password to use when authenticating with the registry.
	Password string `yaml:"password" json:"password"`
}

Registry represents a docker registry

func (Registry) ToBase64

func (r Registry) ToBase64() (string, error)

ToBase64 returns the auth string for the registry

func (Registry) URLFor

func (r Registry) URLFor(image string) string

URLFor returns the url for the registry

type Subnetter

type Subnetter struct {
	// mutex
	Lock *sync.Mutex
	// RegistryPath to the network's subnet registry, a list of used subnets
	RegistryPath string
	// Subnets is a list of subnets that ips can be allocated from
	Subnets []iplib.Net4
}

func (Subnetter) Allocate

func (n Subnetter) Allocate(subnet iplib.Net4) error

func (Subnetter) NextSubnet

func (n Subnetter) NextSubnet() (*iplib.Net4, error)

func (Subnetter) Release

func (n Subnetter) Release(subnet iplib.Net4) error

func (Subnetter) Used

func (n Subnetter) Used() ([]byte, error)

Jump to

Keyboard shortcuts

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