docker

package
v2.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2018 License: Apache-2.0 Imports: 6 Imported by: 62

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 added in v1.2.0

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

func NewVersionedClientFromEnv added in v1.4.0

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 added in v1.5.0

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

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

func (*Client) DockerVersion added in v1.6.0

func (c *Client) DockerVersion() string

func (*Client) EnsureNetwork

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

func (*Client) GetContainerIP added in v1.4.0

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 added in v1.4.0

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