container

package
v0.0.0-...-fe00b7e Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByCreated

type ByCreated []Container

ByCreated allows a list of Container structs to be sorted by the container's created date.

func (ByCreated) Len

func (c ByCreated) Len() int

func (ByCreated) Less

func (c ByCreated) Less(i, j int) bool

Less will compare two elements (identified by index) in the Container list by created-date.

func (ByCreated) Swap

func (c ByCreated) Swap(i, j int)

type Client

type Client interface {
	ListContainers(Filter) ([]Container, error)
	StopContainer(Container, time.Duration) error
	StartContainer(Container) error
	RenameContainer(Container, string) error
	IsContainerStale(Container) (bool, error)
	RemoveImage(Container) error
	ClearIds()
}

A Client is the interface through which watchtower interacts with the Docker API.

func NewClient

func NewClient(dockerHost string, tlsConfig *tls.Config, pullImages bool, auth *dockerclient.AuthConfig) Client

NewClient returns a new Client instance which can be used to interact with the Docker API.

type Container

type Container struct {
	Stale bool
	// contains filtered or unexported fields
}

Container represents a running Docker container.

func NewContainer

func NewContainer(containerInfo *dockerclient.ContainerInfo, imageInfo *dockerclient.ImageInfo) *Container

NewContainer returns a new Container instance instantiated with the specified ContainerInfo and ImageInfo structs.

func SortByDependencies

func SortByDependencies(containers []Container) ([]Container, error)

SortByDependencies will sort the list of containers taking into account any links between containers. Container with no outgoing links will be sorted to the front of the list while containers with links will be sorted after all of their dependencies. This sort order ensures that linked containers can be started in the correct order.

func (Container) Deps

func (c Container) Deps() []string

func (Container) ID

func (c Container) ID() string

ID returns the Docker container ID.

func (Container) ImageID

func (c Container) ImageID() string

ImageID returns the ID of the Docker image that was used to start the container.

func (Container) ImageName

func (c Container) ImageName() string

ImageName returns the name of the Docker image that was used to start the container. If the original image was specified without a particular tag, the "latest" tag is assumed.

func (Container) IsDepensOn

func (c Container) IsDepensOn(container Container) bool

func (Container) IsWatchtower

func (c Container) IsWatchtower() bool

IsWatchtower returns a boolean flag indicating whether or not the current container is the watchtower container itself. The watchtower container is identified by the presence of the "com.centurylinklabs.watchtower" label in the container metadata.

func (c Container) Links() []string

Links returns a list containing the names of all the containers to which this container is linked.

func (Container) Name

func (c Container) Name() string

Name returns the Docker container name.

func (Container) StopSignal

func (c Container) StopSignal() string

StopSignal returns the custom stop signal (if any) that is encoded in the container's metadata. If the container has not specified a custom stop signal, the empty string "" is returned.

type Filter

type Filter func(Container) bool

A Filter is a prototype for a function that can be used to filter the results from a call to the ListContainers() method on the Client.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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