types

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package types defines the data-transfer and interface types shared across watchtower packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container interface {
	ContainerInfo() *dc.InspectResponse
	ID() ContainerID
	IsRunning() bool
	Name() string
	ImageID() ImageID
	SafeImageID() ImageID
	SourceImageID() ImageID
	ImageName() string
	Enabled() (bool, bool)
	IsMonitorOnly(UpdateParams) bool
	Scope() (string, bool)
	Links() []string
	ToRestart() bool
	IsWatchtower() bool
	HasPublishedPorts() bool
	StopSignal() string
	StopTimeout() time.Duration
	HasImageInfo() bool
	ImageIsLocal() bool
	ImageInfo() *image.InspectResponse
	HealthCheckTimeout() (time.Duration, bool)
	ImageCooldown() (time.Duration, bool)
	IsInfrastructure() bool
	ComposeProject() string
	ComposeService() string
	ComposeDependencies() []string
	GetLifecyclePreCheckCommand() string
	GetLifecyclePostCheckCommand() string
	GetLifecyclePreUpdateCommand() string
	GetLifecyclePostUpdateCommand() string
	VerifyConfiguration() error
	SetStale(bool)
	IsStale() bool
	IsNoPull(UpdateParams) bool
	SetLinkedToRestarting(bool)
	IsLinkedToRestarting() bool
	PreUpdateTimeout() int
	PostUpdateTimeout() int
	IsRestarting() bool
	GetCreateConfig() *dc.Config
	GetCreateHostConfig() *dc.HostConfig
}

Container is a docker container running an image

type ContainerID

type ContainerID string

ContainerID is a hash string representing a container instance

func (ContainerID) ShortID

func (id ContainerID) ShortID() (short string)

ShortID returns the 12-character (hex) short version of a container ID hash, removing any "sha256:" prefix if present

type ContainerReport

type ContainerReport interface {
	ID() ContainerID
	Name() string
	CurrentImageID() ImageID
	LatestImageID() ImageID
	ImageName() string
	Error() string
	State() string
}

ContainerReport represents a container that was included in watchtower session

type ConvertibleNotifier

type ConvertibleNotifier interface {
	GetURL(c *cobra.Command) (string, error)
}

ConvertibleNotifier is a notifier capable of creating a shoutrrr URL

type DelayNotifier

type DelayNotifier interface {
	GetDelay() time.Duration
}

DelayNotifier is a notifier that might need to be delayed before sending notifications

type Filter

type Filter func(FilterableContainer) 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.

type FilterableContainer

type FilterableContainer interface {
	Name() string
	IsWatchtower() bool
	Enabled() (bool, bool)
	Scope() (string, bool)
	ImageName() string
}

A FilterableContainer is the interface which is used to filter containers.

type ImageEvent added in v1.12.1

type ImageEvent struct {
	// Action is the Docker event action (e.g. "tag", "load"). Callers decide
	// which actions are interesting; the stream pre-filters to image events
	// but doesn't assume a single consumer policy.
	Action string
	// ImageID is the actor ID from the event (a "sha256:..." digest string).
	ImageID ImageID
	// ImageName is the human-readable reference from the actor's attributes
	// (e.g. "foo:latest"), if the daemon attached one. Empty for events that
	// only carry the digest.
	ImageName string
}

ImageEvent is a minimal image-lifecycle event surfaced by the Docker engine. It is intentionally a watchtower-owned type (not a Docker SDK alias) so the Client interface stays decoupled from the SDK and tests can synthesize events without a running daemon.

type ImageID

type ImageID string

ImageID is a hash string representing a container image

func (ImageID) ShortID

func (id ImageID) ShortID() (short string)

ShortID returns the 12-character (hex) short version of an image ID hash, removing any "sha256:" prefix if present

type Notifier

type Notifier interface {
	StartNotification()
	SendNotification(Report)
	AddLogHook()
	GetNames() []string
	GetURLs() []string
	Close()
}

Notifier is the interface that all notification services have in common

type RegistryCredentials

type RegistryCredentials struct {
	Username string
	Password string // usually a token rather than an actual password
}

RegistryCredentials is a credential pair used for basic auth

type Report

type Report interface {
	Scanned() []ContainerReport
	Updated() []ContainerReport
	Failed() []ContainerReport
	Skipped() []ContainerReport
	Stale() []ContainerReport
	Fresh() []ContainerReport
	All() []ContainerReport
}

Report contains reports for all the containers processed during a session

type TokenResponse

type TokenResponse struct {
	Token     string `json:"token"`
	ExpiresIn int    `json:"expires_in"`
}

TokenResponse is returned by the registry on successful authentication. ExpiresIn is the token lifetime in seconds, per the Docker registry token spec. When omitted by the registry it defaults to 60.

type UpdateParams

type UpdateParams struct {
	Filter             Filter
	Cleanup            bool
	NoRestart          bool
	Timeout            time.Duration
	MonitorOnly        bool
	NoPull             bool
	LifecycleHooks     bool
	RollingRestart     bool
	LabelPrecedence    bool
	HealthCheckGated   bool
	HealthCheckTimeout time.Duration
	ImageCooldown      time.Duration
	ComposeDependsOn   bool
	// RunOnce is set when the caller is Watchtower's --run-once mode. Signals
	// to supply-chain gates like --image-cooldown that deferring an update
	// to "next poll" isn't meaningful — there is no next poll — so those
	// gates should fall through and apply immediately.
	RunOnce bool
}

UpdateParams contains all different options available to alter the behavior of the Update func

Jump to

Keyboard shortcuts

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