docker

package
v0.0.0-...-9f00f78 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitialInterval = 1 * time.Second
	MaxInterval     = 20 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*docker.Client
}

func NewClient

func NewClient(apiPath string) (*Client, error)

NewClient creates a new Docker client and checks we can talk to Docker

func NewVersionedClient

func NewVersionedClient(apiPath string, apiVersionString string) (*Client, error)

func NewVersionedClientFromEnv

func NewVersionedClientFromEnv(apiVersionString string) (*Client, error)

func (*Client) AddObserver

func (c *Client) AddObserver(ob ContainerObserver) error

AddObserver adds an observer for docker events

func (*Client) AllContainerIDs

func (c *Client) AllContainerIDs() ([]string, error)

AllContainerIDs returns all the IDs of Docker containers, whether they are running or not.

func (*Client) DockerVersion

func (c *Client) DockerVersion() string

func (*Client) EnsureNetwork

func (c *Client) EnsureNetwork(networkName, driver, subnet string, options map[string]interface{}) error

func (*Client) GetContainerIP

func (c *Client) GetContainerIP(nameOrID string) (string, error)

This is intended to find an IP address that we can reach the container on; if it is on the Docker bridge network then that address; if on the host network then localhost

func (*Client) Info

func (c *Client) Info() string

func (*Client) IsContainerNotRunning

func (c *Client) IsContainerNotRunning(idStr string) bool

IsContainerNotRunning returns true if we have checked with Docker that the ID is not running

func (*Client) RunningContainerIDs

func (c *Client) RunningContainerIDs() ([]string, error)

RunningContainerIDs returns all the IDs of the running Docker containers.

type ContainerObserver

type ContainerObserver interface {
	ContainerStarted(ident string)
	ContainerDied(ident string)
	ContainerDestroyed(ident string)
}

An observer for container events

Jump to

Keyboard shortcuts

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