Documentation ¶
Index ¶
- Constants
- func Format(ctx FormattingContext, containers []docker.APIContainers)
- func SortContainers(containers []docker.APIContainers, mode SortMode)
- type ContainerFormatter
- func (c *ContainerFormatter) Command() string
- func (c *ContainerFormatter) CreatedAt() string
- func (c *ContainerFormatter) ID() string
- func (c *ContainerFormatter) Image() string
- func (c *ContainerFormatter) Label(name string) string
- func (c *ContainerFormatter) Labels() string
- func (c *ContainerFormatter) Names() string
- func (c *ContainerFormatter) Ports() string
- func (c *ContainerFormatter) RunningFor() string
- func (c *ContainerFormatter) Size() string
- func (c *ContainerFormatter) Status() string
- type DockerDaemon
- func (daemon *DockerDaemon) ContainerByID(cid string) docker.APIContainers
- func (daemon *DockerDaemon) ContainerIDAt(pos int) (string, error)
- func (daemon *DockerDaemon) ContainersCount() int
- func (daemon *DockerDaemon) Inspect(id string) (*docker.Container, error)
- func (daemon *DockerDaemon) Kill(id string) error
- func (daemon *DockerDaemon) Logs(id string) io.ReadCloser
- func (daemon *DockerDaemon) Ok() (bool, error)
- func (daemon *DockerDaemon) Refresh(allContainers bool) error
- func (daemon *DockerDaemon) RestartContainer(id string) error
- func (daemon *DockerDaemon) Rm(id string) bool
- func (daemon *DockerDaemon) Sort(sortMode SortMode)
- func (daemon *DockerDaemon) Stats(id string) (<-chan *Stats, chan<- bool, error)
- func (daemon *DockerDaemon) StopContainer(id string) error
- type DockerEnv
- type FormattingContext
- type SortMode
- type Stats
Constants ¶
const ( DefaultTableFormat = "{{.ID}}\t{{.Image}}\t{{.Command}}\t{{.RunningFor}} ago\t{{.Status}}\t{{.Ports}}\t{{.Names}}" DefaultQuietFormat = "{{.ID}}" )
Variables ¶
This section is empty.
Functions ¶
func Format ¶
func Format(ctx FormattingContext, containers []docker.APIContainers)
Format helps to format the output using the parameters set in the FormattingContext.
func SortContainers ¶
func SortContainers(containers []docker.APIContainers, mode SortMode)
Sort the given containers slice using the given mode
Types ¶
type ContainerFormatter ¶
type ContainerFormatter struct {
// contains filtered or unexported fields
}
func (*ContainerFormatter) Command ¶
func (c *ContainerFormatter) Command() string
func (*ContainerFormatter) CreatedAt ¶
func (c *ContainerFormatter) CreatedAt() string
func (*ContainerFormatter) ID ¶
func (c *ContainerFormatter) ID() string
func (*ContainerFormatter) Image ¶
func (c *ContainerFormatter) Image() string
func (*ContainerFormatter) Label ¶
func (c *ContainerFormatter) Label(name string) string
func (*ContainerFormatter) Labels ¶
func (c *ContainerFormatter) Labels() string
func (*ContainerFormatter) Names ¶
func (c *ContainerFormatter) Names() string
func (*ContainerFormatter) Ports ¶
func (c *ContainerFormatter) Ports() string
func (*ContainerFormatter) RunningFor ¶
func (c *ContainerFormatter) RunningFor() string
func (*ContainerFormatter) Size ¶
func (c *ContainerFormatter) Size() string
func (*ContainerFormatter) Status ¶
func (c *ContainerFormatter) Status() string
type DockerDaemon ¶
type DockerDaemon struct { Containers []docker.APIContainers DockerEnv *DockerEnv // contains filtered or unexported fields }
DockerDaemon knows how to talk to the Docker daemon
func ConnectToDaemon ¶
func ConnectToDaemon() (*DockerDaemon, error)
ConnectToDaemon connects with the Docker daemon. if allContainers is true, then a list of both running and non-running containers is retrieved.
func (*DockerDaemon) ContainerByID ¶
func (daemon *DockerDaemon) ContainerByID(cid string) docker.APIContainers
ContainerByID returns the container with the given ID
func (*DockerDaemon) ContainerIDAt ¶
func (daemon *DockerDaemon) ContainerIDAt(pos int) (string, error)
ContainerIDAt returns the container ID of the container found at the given position.
func (*DockerDaemon) ContainersCount ¶
func (daemon *DockerDaemon) ContainersCount() int
ContainersCount returns the number of containers found.
func (*DockerDaemon) Inspect ¶
func (daemon *DockerDaemon) Inspect(id string) (*docker.Container, error)
Inspect the container with the given id
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) io.ReadCloser
Logs shows the logs of the container with the given id
func (*DockerDaemon) Ok ¶
func (daemon *DockerDaemon) Ok() (bool, error)
Ok is true if connecting to the Docker daemon went fine
func (*DockerDaemon) Refresh ¶
func (daemon *DockerDaemon) Refresh(allContainers bool) error
Refresh the container list
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) bool
Rm removes the container with the given id
func (*DockerDaemon) Sort ¶
func (daemon *DockerDaemon) Sort(sortMode SortMode)
Sort the list of containers by the given mode
func (*DockerDaemon) Stats ¶
func (daemon *DockerDaemon) Stats(id string) (<-chan *Stats, chan<- bool, error)
Stats shows resource usage statistics of the container with the given id
func (*DockerDaemon) StopContainer ¶
func (daemon *DockerDaemon) StopContainer(id string) error
StopContainer stops the container with the given id
type FormattingContext ¶
type FormattingContext struct { // Output is the output stream to which the formatted string is written. Output io.Writer // Format is used to choose raw, table or custom format for the output. Template *template.Template // Trunc when set to true will truncate the output of certain fields such as Container ID. Trunc bool // The selected container Selected int // contains filtered or unexported fields }
FormattingContext contains information required by the formatter to print the output as desired.
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 Stats *godocker.Stats }
Stats holds runtime stats for a container
func BuildStats ¶
func BuildStats(container godocker.APIContainers, stats *godocker.Stats) *Stats
BuildStats builds Stats with the given information