Documentation
¶
Index ¶
- Constants
- Variables
- func DurationForHumans(duration int64) string
- func ImageID(uglyID string) string
- func IsContainerRunning(container *Container) bool
- func NewNodeAvailability(availability string) swarm.NodeAvailability
- func ShortImageID(uglyID string) string
- func SortContainers(containers []*Container, mode SortMode)
- func SortImages(images []image.Summary, mode SortMode)
- func SortNetworks(networks []network.Inspect, mode SortMode)
- func SortNodes(nodes []swarm.Node, mode SortMode)
- func SortServices(services []swarm.Service, mode SortMode)
- func SortStacks(stacks []Stack, mode SortMode)
- func SortTasks(tasks []swarm.Task, mode SortMode)
- func TruncateID(id string) string
- type CallbackRegistry
- type Command
- type CommandDescription
- type Container
- type ContainerAPI
- type ContainerDaemon
- type ContainerFilter
- func (cf ContainerFilter) Apply(c []*Container) []*Container
- func (cf ContainerFilter) ByID(id string) ContainerFilter
- func (cf ContainerFilter) ByName(name string) ContainerFilter
- func (cf ContainerFilter) ByRunningState(running bool) ContainerFilter
- func (cf ContainerFilter) NotRunning() ContainerFilter
- func (cf ContainerFilter) Running() ContainerFilter
- func (cf ContainerFilter) Unfiltered() ContainerFilter
- type ContainerRuntime
- type ContainerStore
- type DockerDaemon
- func (daemon *DockerDaemon) ContainerByID(cid string) *Container
- func (daemon *DockerDaemon) Containers(filters []ContainerFilter, mode SortMode) []*Container
- func (daemon *DockerDaemon) DiskUsage() (dockerTypes.DiskUsage, error)
- func (daemon *DockerDaemon) DockerEnv() Env
- func (daemon *DockerDaemon) EventLog() *EventLog
- func (daemon *DockerDaemon) Events(ctx context.Context) (<-chan dockerEvents.Message, error)
- func (daemon *DockerDaemon) History(id string) ([]image.HistoryResponseItem, error)
- func (daemon *DockerDaemon) ImageByID(id string) (image.Summary, error)
- func (daemon *DockerDaemon) Images() ([]image.Summary, error)
- func (daemon *DockerDaemon) Info() (system.Info, error)
- func (daemon *DockerDaemon) Inspect(id string) (container.InspectResponse, error)
- func (daemon *DockerDaemon) InspectImage(name string) (image.InspectResponse, error)
- func (daemon *DockerDaemon) IsContainerRunning(id string) bool
- func (daemon *DockerDaemon) Kill(id string) error
- func (daemon *DockerDaemon) Logs(id string, since string, withTimeStamps bool) (io.ReadCloser, error)
- func (daemon *DockerDaemon) NetworkInspect(id string) (network.Inspect, error)
- func (daemon *DockerDaemon) Networks() ([]network.Inspect, error)
- func (daemon *DockerDaemon) Node(id string) (*swarm.Node, error)
- func (daemon *DockerDaemon) NodeChangeAvailability(nodeID string, availability swarm.NodeAvailability) error
- func (daemon *DockerDaemon) NodeTasks(nodeID string) ([]swarm.Task, error)
- func (daemon *DockerDaemon) Nodes() ([]swarm.Node, error)
- func (daemon *DockerDaemon) Ok() (bool, error)
- func (daemon *DockerDaemon) Prune() (*PruneReport, error)
- func (daemon *DockerDaemon) Refresh(notify func(error))
- func (daemon *DockerDaemon) RemoveAllStoppedContainers() (int, error)
- func (daemon *DockerDaemon) RemoveDanglingImages() (int, error)
- func (daemon *DockerDaemon) RemoveNetwork(id string) error
- func (daemon *DockerDaemon) RemoveUnusedImages() (int, error)
- func (daemon *DockerDaemon) ResolveNode(id string) (string, error)
- func (daemon *DockerDaemon) ResolveService(id string) (string, error)
- func (daemon *DockerDaemon) RestartContainer(id string) error
- func (daemon *DockerDaemon) Rm(id string) error
- func (daemon *DockerDaemon) Rmi(name string, force bool) ([]image.DeleteResponse, error)
- func (daemon *DockerDaemon) RunImage(image image.Summary, command string) error
- func (daemon *DockerDaemon) Service(id string) (*swarm.Service, error)
- func (daemon *DockerDaemon) ServiceLogs(id string, since string, withTimestamps bool) (io.ReadCloser, error)
- func (daemon *DockerDaemon) ServiceRemove(id string) error
- func (daemon *DockerDaemon) ServiceScale(id string, replicas uint64) error
- func (daemon *DockerDaemon) ServiceTasks(services ...string) ([]swarm.Task, error)
- func (daemon *DockerDaemon) ServiceUpdate(id string) error
- func (daemon *DockerDaemon) Services() ([]swarm.Service, error)
- func (daemon *DockerDaemon) StackConfigs(stack string) ([]swarm.Config, error)
- func (daemon *DockerDaemon) StackNetworks(stack string) ([]network.Inspect, error)
- func (daemon *DockerDaemon) StackRemove(stack string) error
- func (daemon *DockerDaemon) StackSecrets(stack string) ([]swarm.Secret, error)
- func (daemon *DockerDaemon) StackServices(stack string) ([]swarm.Service, error)
- func (daemon *DockerDaemon) StackTasks(stack string) ([]swarm.Task, error)
- func (daemon *DockerDaemon) Stacks() ([]Stack, error)
- func (daemon *DockerDaemon) StatsChannel(container *Container) (*StatsChannel, error)
- func (daemon *DockerDaemon) StopContainer(id string) error
- func (daemon *DockerDaemon) Task(id string) (swarm.Task, error)
- func (daemon *DockerDaemon) Top(ctx context.Context, id string) (container.TopResponse, error)
- func (daemon *DockerDaemon) Version() (*dockerTypes.Version, error)
- func (daemon *DockerDaemon) VolumeInspect(ctx context.Context, volumeID string) (volume.Volume, error)
- func (daemon *DockerDaemon) VolumeList(ctx context.Context) ([]*volume.Volume, error)
- func (daemon *DockerDaemon) VolumePrune(ctx context.Context) (int, error)
- func (daemon *DockerDaemon) VolumeRemove(ctx context.Context, volumeID string, force bool) error
- func (daemon *DockerDaemon) VolumeRemoveAll(ctx context.Context) (int, error)
- type Env
- type EventCallback
- type EventLog
- type ImageAPI
- type NetworkAPI
- type PruneReport
- type Resolver
- type SortMode
- type SourceType
- type Stack
- type Stats
- type StatsChannel
- type SwarmAPI
- type VolumesAPI
Constants ¶
const ( //ContainerSource for events emitted by Docker containers ContainerSource = SourceType("container") //DaemonSource for events emitted by the Docker daemon DaemonSource = SourceType("daemon") //ImageSource for events emitted by Docker images ImageSource = SourceType("image") //NetworkSource for events emitted by Docker networks NetworkSource = SourceType("network") //PluginSource for events emitted by Docker plugins PluginSource = SourceType("plugin") //VolumeSource for events emitted by Docker volumes VolumeSource = SourceType("volume") //ServiceSource for events emitted by Docker services ServiceSource = SourceType("service") //NodeSource for events emitted by Docker nodes NodeSource = SourceType("node") //SecretSource for events emitted by Docker secrets SecretSource = SourceType("secret") )
const ( //Whale ascii art Whale = `` /* 243-byte string literal not displayed */ //Whale0 ascii art for animations Whale0 = `` /* 243-byte string literal not displayed */ //Whale1 ascii art for animations Whale1 = `` /* 243-byte string literal not displayed */ //Whale2 ascii art for animations Whale2 = `` /* 243-byte string literal not displayed */ //Whale3 ascii art for animations Whale3 = `` /* 243-byte string literal not displayed */ //Whale4 ascii art for animations Whale4 = `` /* 243-byte string literal not displayed */ //Whale5 ascii art for animations Whale5 = `` /* 243-byte string literal not displayed */ //Whale6 ascii art for animations Whale6 = `` /* 243-byte string literal not displayed */ //Whale7 ascii art for animations Whale7 = `` /* 243-byte string literal not displayed */ )
const (
//DefaultCapacity of a new EventLog.
DefaultCapacity = 50
)
const ( //DefaultConnectionTimeout is the timeout for connecting with the Docker daemon DefaultConnectionTimeout = 32 * time.Second )
const ( //DefaultDockerHost is used as a default docker host to connect to //if no other value is given. DefaultDockerHost = "unix:///var/run/docker.sock" )
const ( // LabelNamespace is the label used to track stack resources //Copied from https://github.com/docker/cli/blob/master/cli/compose/convert/compose.go LabelNamespace = "com.docker.stack.namespace" )
const (
//ShortLen defines the default size of shortened ID
ShortLen = 12
)
Variables ¶
var CommandDescriptions = justDescriptions(ContainerCommands)
CommandDescriptions lists command descriptions in the same order as they are found in ContainerCommands
var ContainerCommands = []CommandDescription{ {LOGS, "Fetch logs"}, {INSPECT, "Inspect container"}, {KILL, "Kill container"}, {RM, "Remove container"}, {RESTART, "Restart"}, {HISTORY, "Show image history"}, {STATS, "Stats + Top"}, {STOP, "Stop"}, }
ContainerCommands is the list of container commands
Functions ¶
func DurationForHumans ¶
DurationForHumans returns a human-readable approximation of a duration represented as an int64 nanosecond count.
func ImageID ¶
ImageID removes anything that is not part of the ID but is being added by the docker library
func IsContainerRunning ¶
IsContainerRunning returns true if the given container is running
func NewNodeAvailability ¶
func NewNodeAvailability(availability string) swarm.NodeAvailability
NewNodeAvailability builds NodeAvailability from the given string
func ShortImageID ¶
ShortImageID shortens and beutifies an id
func SortContainers ¶
SortContainers sorts the given containers slice using the given mode
func SortImages ¶
SortImages sorts the given image slice using the given mode
func SortNetworks ¶
SortNetworks sorts the given network slice using the given mode
func SortServices ¶
SortServices sorts the given service slice using the given mode
func SortStacks ¶
SortStacks sorts the given stack slice using the given mode
func TruncateID ¶
TruncateID returns a shorthand version of a string identifier for convenience. A collision with other shorthands is very unlikely, but possible. In case of a collision a lookup with TruncIndex.Get() will fail, and the caller will need to use a longer prefix, or the full-length Id.
Types ¶
type CallbackRegistry ¶
type CallbackRegistry interface {
Register(actor SourceType, callback EventCallback)
}
CallbackRegistry d
var GlobalRegistry CallbackRegistry
GlobalRegistry is a globally available CallbackRegistry
type Command ¶
type Command int
Command represents a docker command
func CommandFromDescription ¶
CommandFromDescription returns the command with the given description, if any
type CommandDescription ¶
CommandDescription describes docker commands
type Container ¶
type Container struct {
container.Summary
Detail container.InspectResponse
}
Container holds a detailed view of a container. Detail holds the full inspect response (State, Config, etc.).
type ContainerAPI ¶
type ContainerAPI interface {
ContainerByID(id string) *Container
Containers(filter []ContainerFilter, mode SortMode) []*Container
Inspect(id string) (container.InspectResponse, error)
IsContainerRunning(id string) bool
Kill(id string) error
Logs(id string, since string, withTimeStamp bool) (io.ReadCloser, error)
RemoveAllStoppedContainers() (int, error)
RestartContainer(id string) error
StopContainer(id string) error
}
ContainerAPI is a subset of the Docker API to manage containers
type ContainerDaemon ¶
type ContainerDaemon interface {
ContainerAPI
ImageAPI
NetworkAPI
VolumesAPI
SwarmAPI
ContainerRuntime
DiskUsage() (types.DiskUsage, error)
DockerEnv() Env
Events(ctx context.Context) (<-chan events.Message, error)
EventLog() *EventLog
Info() (system.Info, error)
InspectImage(name string) (image.InspectResponse, error)
Ok() (bool, error)
Prune() (*PruneReport, error)
Rm(id string) error
Refresh(notify func(error))
RemoveNetwork(id string) error
Version() (*types.Version, error)
}
ContainerDaemon describes what is expected from the container daemon
type ContainerFilter ¶
ContainerFilter defines a function to filter container
var ContainerFilters ContainerFilter
ContainerFilters is a holder of predefined ContainerFilter(s) The intentions is that something like 'ContainerFilters.ByName("name")' can be used to declare a filter.
func (ContainerFilter) Apply ¶
func (cf ContainerFilter) Apply(c []*Container) []*Container
Apply applies this filter to the given slice of containers
func (ContainerFilter) ByID ¶
func (cf ContainerFilter) ByID(id string) ContainerFilter
ByID filters containers by ID
func (ContainerFilter) ByName ¶
func (cf ContainerFilter) ByName(name string) ContainerFilter
ByName filters containers by name
func (ContainerFilter) ByRunningState ¶
func (cf ContainerFilter) ByRunningState(running bool) ContainerFilter
ByRunningState filters containers by its running state
func (ContainerFilter) NotRunning ¶
func (cf ContainerFilter) NotRunning() ContainerFilter
NotRunning filters out container that are running
func (ContainerFilter) Running ¶
func (cf ContainerFilter) Running() ContainerFilter
Running filters out container that are not running
func (ContainerFilter) Unfiltered ¶
func (cf ContainerFilter) Unfiltered() ContainerFilter
Unfiltered does not filter containers
type ContainerRuntime ¶
type ContainerRuntime interface {
StatsChannel(container *Container) (*StatsChannel, error)
Top(ctx context.Context, id string) (container.TopResponse, error)
}
ContainerRuntime is the subset of the Docker API to query container runtime information
type ContainerStore ¶
type ContainerStore interface {
Get(id string) *Container
List() []*Container
Remove(id string)
Size() int
}
ContainerStore defines a container storage.
func NewDockerContainerStore ¶
func NewDockerContainerStore(client dockerAPI.ContainerAPIClient) (ContainerStore, error)
NewDockerContainerStore creates a new Docker container store that will use the given Docker daemon client to retrieve container information.
type DockerDaemon ¶
type DockerDaemon struct {
// contains filtered or unexported fields
}
DockerDaemon knows how to talk to the Docker daemon
func ConnectToDaemon ¶
func ConnectToDaemon(env Env) (*DockerDaemon, error)
ConnectToDaemon connects to a Docker daemon using the given properties.
func (*DockerDaemon) ContainerByID ¶
func (daemon *DockerDaemon) ContainerByID(cid string) *Container
ContainerByID returns the container with the given ID
func (*DockerDaemon) Containers ¶
func (daemon *DockerDaemon) Containers(filters []ContainerFilter, mode SortMode) []*Container
Containers returns the containers known by the daemon
func (*DockerDaemon) DiskUsage ¶
func (daemon *DockerDaemon) DiskUsage() (dockerTypes.DiskUsage, error)
DiskUsage returns reported Docker disk usage
func (*DockerDaemon) DockerEnv ¶
func (daemon *DockerDaemon) DockerEnv() Env
DockerEnv returns Docker-related environment variables
func (*DockerDaemon) EventLog ¶
func (daemon *DockerDaemon) EventLog() *EventLog
EventLog returns the events log
func (*DockerDaemon) Events ¶
func (daemon *DockerDaemon) Events(ctx context.Context) (<-chan dockerEvents.Message, error)
Events returns a channel to receive Docker events. The caller owns cancellation via the provided context. The returned channel is closed when the context is cancelled or the Docker daemon disconnects (error on the event stream).
func (*DockerDaemon) History ¶
func (daemon *DockerDaemon) History(id string) ([]image.HistoryResponseItem, error)
History returns image history
func (*DockerDaemon) ImageByID ¶
func (daemon *DockerDaemon) ImageByID(id string) (image.Summary, error)
ImageByID returns the image with the given ID
func (*DockerDaemon) Images ¶
func (daemon *DockerDaemon) Images() ([]image.Summary, error)
Images returns the list of Docker images
func (*DockerDaemon) Info ¶
func (daemon *DockerDaemon) Info() (system.Info, error)
Info returns system-wide information about the Docker server.
func (*DockerDaemon) Inspect ¶
func (daemon *DockerDaemon) Inspect(id string) (container.InspectResponse, error)
Inspect the container with the given id
func (*DockerDaemon) InspectImage ¶
func (daemon *DockerDaemon) InspectImage(name string) (image.InspectResponse, error)
InspectImage the image with the name
func (*DockerDaemon) IsContainerRunning ¶
func (daemon *DockerDaemon) IsContainerRunning(id string) bool
IsContainerRunning returns true if the container with the given is running
func (*DockerDaemon) Kill ¶
func (daemon *DockerDaemon) Kill(id string) error
Kill the container with the given id
func (*DockerDaemon) Logs ¶
func (daemon *DockerDaemon) Logs(id string, since string, withTimeStamps bool) (io.ReadCloser, error)
Logs shows the logs of the container with the given id
func (*DockerDaemon) NetworkInspect ¶
func (daemon *DockerDaemon) NetworkInspect(id string) (network.Inspect, error)
NetworkInspect returns network detailed information
func (*DockerDaemon) Networks ¶
func (daemon *DockerDaemon) Networks() ([]network.Inspect, error)
Networks returns the list of Docker networks
func (*DockerDaemon) Node ¶
func (daemon *DockerDaemon) Node(id string) (*swarm.Node, error)
Node returns the node with the given id
func (*DockerDaemon) NodeChangeAvailability ¶
func (daemon *DockerDaemon) NodeChangeAvailability(nodeID string, availability swarm.NodeAvailability) error
NodeChangeAvailability changes the availability of the given node
func (*DockerDaemon) NodeTasks ¶
func (daemon *DockerDaemon) NodeTasks(nodeID string) ([]swarm.Task, error)
NodeTasks returns the tasks being run by the given node
func (*DockerDaemon) Nodes ¶
func (daemon *DockerDaemon) Nodes() ([]swarm.Node, error)
Nodes returns the nodes that are part of the Swarm
func (*DockerDaemon) Ok ¶
func (daemon *DockerDaemon) Ok() (bool, error)
Ok is true if connecting to the Docker daemon went fine
func (*DockerDaemon) Prune ¶
func (daemon *DockerDaemon) Prune() (*PruneReport, error)
Prune requests the Docker daemon to prune unused containers, images networks and volumes
func (*DockerDaemon) Refresh ¶
func (daemon *DockerDaemon) Refresh(notify func(error))
Refresh the container list asynchronously, using the given notifier to signal operation completion.
func (*DockerDaemon) RemoveAllStoppedContainers ¶
func (daemon *DockerDaemon) RemoveAllStoppedContainers() (int, error)
RemoveAllStoppedContainers removes all stopped containers
func (*DockerDaemon) RemoveDanglingImages ¶
func (daemon *DockerDaemon) RemoveDanglingImages() (int, error)
RemoveDanglingImages removes dangling images
func (*DockerDaemon) RemoveNetwork ¶
func (daemon *DockerDaemon) RemoveNetwork(id string) error
RemoveNetwork removes the network with the given id
func (*DockerDaemon) RemoveUnusedImages ¶
func (daemon *DockerDaemon) RemoveUnusedImages() (int, error)
RemoveUnusedImages removes unused images
func (*DockerDaemon) ResolveNode ¶
func (daemon *DockerDaemon) ResolveNode(id string) (string, error)
ResolveNode will attempt to resolve the given node ID to a name.
func (*DockerDaemon) ResolveService ¶
func (daemon *DockerDaemon) ResolveService(id string) (string, error)
ResolveService will attempt to resolve the given service ID to a name.
func (*DockerDaemon) RestartContainer ¶
func (daemon *DockerDaemon) RestartContainer(id string) error
RestartContainer restarts the container with the given id
func (*DockerDaemon) Rm ¶
func (daemon *DockerDaemon) Rm(id string) error
Rm removes the container with the given id
func (*DockerDaemon) Rmi ¶
func (daemon *DockerDaemon) Rmi(name string, force bool) ([]image.DeleteResponse, error)
Rmi removes the image with the given name
func (*DockerDaemon) RunImage ¶
func (daemon *DockerDaemon) RunImage(image image.Summary, command string) error
RunImage creates a container based on the given image and runs the given command Kind of like running "docker run $image $command" from the command line.
func (*DockerDaemon) Service ¶
func (daemon *DockerDaemon) Service(id string) (*swarm.Service, error)
Service returns service details of the service with the given id
func (*DockerDaemon) ServiceLogs ¶
func (daemon *DockerDaemon) ServiceLogs(id string, since string, withTimestamps bool) (io.ReadCloser, error)
ServiceLogs returns logs of the service with the given id
func (*DockerDaemon) ServiceRemove ¶
func (daemon *DockerDaemon) ServiceRemove(id string) error
ServiceRemove removes the service with the given in
func (*DockerDaemon) ServiceScale ¶
func (daemon *DockerDaemon) ServiceScale(id string, replicas uint64) error
ServiceScale scales the given service by the given number of replicas
func (*DockerDaemon) ServiceTasks ¶
func (daemon *DockerDaemon) ServiceTasks(services ...string) ([]swarm.Task, error)
ServiceTasks returns the tasks being run that belong to the given list of services
func (*DockerDaemon) ServiceUpdate ¶
func (daemon *DockerDaemon) ServiceUpdate(id string) error
ServiceUpdate forces an update of the given service
func (*DockerDaemon) Services ¶
func (daemon *DockerDaemon) Services() ([]swarm.Service, error)
Services returns the services known by the Swarm
func (*DockerDaemon) StackConfigs ¶
func (daemon *DockerDaemon) StackConfigs(stack string) ([]swarm.Config, error)
StackConfigs returns the configs created for the given stack
func (*DockerDaemon) StackNetworks ¶
func (daemon *DockerDaemon) StackNetworks(stack string) ([]network.Inspect, error)
StackNetworks returns the networks created for the given stack
func (*DockerDaemon) StackRemove ¶
func (daemon *DockerDaemon) StackRemove(stack string) error
StackRemove removes the stack with the given in
func (*DockerDaemon) StackSecrets ¶
func (daemon *DockerDaemon) StackSecrets(stack string) ([]swarm.Secret, error)
StackSecrets return the secrets created for the given stack
func (*DockerDaemon) StackServices ¶
func (daemon *DockerDaemon) StackServices(stack string) ([]swarm.Service, error)
StackServices returns the given stack service list
func (*DockerDaemon) StackTasks ¶
func (daemon *DockerDaemon) StackTasks(stack string) ([]swarm.Task, error)
StackTasks returns the given stack task list
func (*DockerDaemon) Stacks ¶
func (daemon *DockerDaemon) Stacks() ([]Stack, error)
Stacks returns the stack list
func (*DockerDaemon) StatsChannel ¶
func (daemon *DockerDaemon) StatsChannel(container *Container) (*StatsChannel, error)
StatsChannel creates a channel with the runtime stats of the given container
func (*DockerDaemon) StopContainer ¶
func (daemon *DockerDaemon) StopContainer(id string) error
StopContainer stops the container with the given id
func (*DockerDaemon) Task ¶
func (daemon *DockerDaemon) Task(id string) (swarm.Task, error)
Task returns the task with the given id
func (*DockerDaemon) Top ¶
func (daemon *DockerDaemon) Top(ctx context.Context, id string) (container.TopResponse, error)
Top returns Top information for the given container
func (*DockerDaemon) Version ¶
func (daemon *DockerDaemon) Version() (*dockerTypes.Version, error)
Version returns version information about the Docker Engine
func (*DockerDaemon) VolumeInspect ¶
func (daemon *DockerDaemon) VolumeInspect(ctx context.Context, volumeID string) (volume.Volume, error)
VolumeInspect returns the details of the given volume.
func (*DockerDaemon) VolumeList ¶
VolumeList returns the list of volumes.
func (*DockerDaemon) VolumePrune ¶
func (daemon *DockerDaemon) VolumePrune(ctx context.Context) (int, error)
VolumePrune removes unused volumes.
func (*DockerDaemon) VolumeRemove ¶
VolumeRemove removes the given volume.
func (*DockerDaemon) VolumeRemoveAll ¶
func (daemon *DockerDaemon) VolumeRemoveAll(ctx context.Context) (int, error)
VolumeRemoveAll removes all the volumes.
type Env ¶
type Env struct {
DockerHost string
DockerTLSVerify bool //tls must be verified
DockerCertPath string
DockerAPIVersion string
}
Env holds Docker-related environment variables
type EventCallback ¶
EventCallback defines a callback function for messages
type EventLog ¶
EventLog keeps track of docker events. It has a limited capacity and behaves as a Circular Buffer - adding a new event removes the oldest one if the buffer is at its max capacity.
func NewEventLog ¶
func NewEventLog() *EventLog
NewEventLog creates an event log with the default capacity
func (*EventLog) Init ¶
Init sets the log in a working state. Must be called before doing any other operation
type ImageAPI ¶
type ImageAPI interface {
History(id string) ([]image.HistoryResponseItem, error)
ImageByID(id string) (image.Summary, error)
Images() ([]image.Summary, error)
RemoveDanglingImages() (int, error)
RemoveUnusedImages() (int, error)
Rmi(id string, force bool) ([]image.DeleteResponse, error)
RunImage(image image.Summary, command string) error
}
ImageAPI is a subset of the Docker API to manage images
type NetworkAPI ¶
type NetworkAPI interface {
Networks() ([]network.Inspect, error)
NetworkInspect(id string) (network.Inspect, error)
}
NetworkAPI is a subset of the Docker API to manage networks
type PruneReport ¶
type PruneReport struct {
ContainerReport container.PruneReport
ImagesReport image.PruneReport
NetworksReport network.PruneReport
VolumesReport volume.PruneReport
}
PruneReport represents the result of a prune operation
func (*PruneReport) TotalSpaceReclaimed ¶
func (p *PruneReport) TotalSpaceReclaimed() uint64
TotalSpaceReclaimed reports the total space reclaimed
type SortMode ¶
type SortMode uint16
SortMode represents allowed modes to sort a container slice
Allowed sort methods
const ( NoSortImages SortMode = iota SortImagesByID SortImagesByRepo SortImagesBySize SortImagesByCreationDate )
Allowed sort methods
const ( NoSortNetworks SortMode = iota SortNetworksByID SortNetworksByName SortNetworksByDriver SortNetworksByContainerCount SortNetworksByServiceCount SortNetworksBySubnet )
Allowed sort methods
const ( NoSortNode SortMode = iota SortByNodeName SortByNodeRole SortByNodeCPU SortByNodeMem SortByNodeStatus )
Allowed sort methods
type SourceType ¶
type SourceType string
SourceType is a representation of the sources types that might emit Docker events
type Stack ¶
type Stack struct {
Name string
Orchestrator string
Services int
Networks int
Configs int
Secrets int
}
Stack contains information about a Docker Swarm stack
type Stats ¶
type Stats struct {
CID string
Command string
CPUPercentage float64
Memory float64
MemoryLimit float64
MemoryPercentage float64
NetworkRx float64
NetworkTx float64
BlockRead float64
BlockWrite float64
PidsCurrent uint64
Stats *container.StatsResponse
ProcessList *container.TopResponse
Error error
}
Stats holds runtime stats for a container
type StatsChannel ¶
type StatsChannel struct {
Container *Container
// contains filtered or unexported fields
}
StatsChannel manages the stats channel of a container
type SwarmAPI ¶
type SwarmAPI interface {
Node(id string) (*swarm.Node, error)
NodeChangeAvailability(nodeID string, availability swarm.NodeAvailability) error
Nodes() ([]swarm.Node, error)
NodeTasks(nodeID string) ([]swarm.Task, error)
ResolveNode(id string) (string, error)
ResolveService(id string) (string, error)
Service(id string) (*swarm.Service, error)
ServiceLogs(id string, since string, withTimeStamps bool) (io.ReadCloser, error)
Services() ([]swarm.Service, error)
ServiceRemove(id string) error
ServiceScale(id string, replicas uint64) error
ServiceTasks(services ...string) ([]swarm.Task, error)
ServiceUpdate(id string) error
Stacks() ([]Stack, error)
StackConfigs(stack string) ([]swarm.Config, error)
StackNetworks(stack string) ([]network.Inspect, error)
StackRemove(id string) error
StackSecrets(stack string) ([]swarm.Secret, error)
StackTasks(stack string) ([]swarm.Task, error)
Task(id string) (swarm.Task, error)
}
SwarmAPI defines the API for Docker Swarm
type VolumesAPI ¶
type VolumesAPI interface {
VolumeInspect(ctx context.Context, volumeID string) (volume.Volume, error)
VolumeList(ctx context.Context) ([]*volume.Volume, error)
VolumePrune(ctx context.Context) (int, error)
VolumeRemove(ctx context.Context, volumeID string, force bool) error
VolumeRemoveAll(ctx context.Context) (int, error)
}
VolumesAPI defines the API for Docker volumes.
Source Files
¶
- api.go
- beutifier.go
- commands.go
- connection.go
- container_config.go
- daemon.go
- docker_environment.go
- event_listener.go
- events.go
- events_log.go
- filter.go
- images.go
- memory_store.go
- prune_report.go
- resolver.go
- sort.go
- sort_images.go
- sort_networks.go
- sort_nodes.go
- sort_services.go
- sort_services_tasks.go
- sort_stacks.go
- stack.go
- stack_remove.go
- stats.go
- swarm.go
- whale.go