Documentation ¶
Index ¶
- func ContainsWatchtowerLabel(labels map[string]string) bool
- type Client
- type Container
- func (c Container) ContainerInfo() *types.ContainerJSON
- func (c Container) Enabled() (bool, bool)
- func (c Container) GetLifecyclePostCheckCommand() string
- func (c Container) GetLifecyclePostUpdateCommand() string
- func (c Container) GetLifecyclePreCheckCommand() string
- func (c Container) GetLifecyclePreUpdateCommand() string
- func (c Container) ID() string
- func (c Container) ImageID() string
- func (c Container) ImageName() string
- func (c Container) IsRunning() bool
- func (c Container) IsWatchtower() bool
- func (c Container) Links() []string
- func (c Container) Name() string
- func (c Container) StopSignal() string
- func (c Container) ToRestart() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsWatchtowerLabel ¶
ContainsWatchtowerLabel takes a map of labels and values and tells the consumer whether it contains a valid watchtower instance label
Types ¶
type Client ¶
type Client interface { ListContainers(t.Filter) ([]Container, error) GetContainer(containerID string) (Container, error) StopContainer(Container, time.Duration) error StartContainer(Container) (string, error) RenameContainer(Container, string) error IsContainerStale(Container) (bool, error) ExecuteCommand(containerID string, command string) error RemoveImageByID(string) error }
A Client is the interface through which watchtower interacts with the Docker API.
func NewClient ¶
NewClient returns a new Client instance which can be used to interact with the Docker API. The client reads its configuration from the following environment variables:
- DOCKER_HOST the docker-engine host to send api requests to
- DOCKER_TLS_VERIFY whether to verify tls certificates
- DOCKER_API_VERSION the minimum docker api version to work with
type Container ¶
Container represents a running Docker container.
func NewContainer ¶
func NewContainer(containerInfo *types.ContainerJSON, imageInfo *types.ImageInspect) *Container
NewContainer returns a new Container instance instantiated with the specified ContainerInfo and ImageInfo structs.
func (Container) ContainerInfo ¶ added in v0.3.11
func (c Container) ContainerInfo() *types.ContainerJSON
ContainerInfo fetches JSON info for the container
func (Container) Enabled ¶
Enabled returns the value of the container enabled label and if the label was set.
func (Container) GetLifecyclePostCheckCommand ¶ added in v0.3.10
GetLifecyclePostCheckCommand returns the post-check command set in the container metadata or an empty string
func (Container) GetLifecyclePostUpdateCommand ¶
GetLifecyclePostUpdateCommand returns the post-update command set in the container metadata or an empty string
func (Container) GetLifecyclePreCheckCommand ¶ added in v0.3.10
GetLifecyclePreCheckCommand returns the pre-check command set in the container metadata or an empty string
func (Container) GetLifecyclePreUpdateCommand ¶
GetLifecyclePreUpdateCommand returns the pre-update command set in the container metadata or an empty string
func (Container) ImageID ¶
ImageID returns the ID of the Docker image that was used to start the container.
func (Container) ImageName ¶
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) IsRunning ¶
IsRunning returns a boolean flag indicating whether or not the current container is running. The status is determined by the value of the container's "State.Running" property.
func (Container) IsWatchtower ¶
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 (Container) Links ¶
Links returns a list containing the names of all the containers to which this container is linked.
func (Container) StopSignal ¶
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.