docker

package
v0.3.0-beta Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2015 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
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 to a Docker daemon using environment properties.

func ConnectToGivenDaemon

func ConnectToGivenDaemon(env *DockerEnv) (*DockerDaemon, error)

ConnectToGivenDaemon connects to a Docker daemon using the given properties.

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, <-chan 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 DockerEnv

type DockerEnv struct {
	DockerHost      string
	DockerTLSVerify bool
	DockerCertPath  string
}

DockerEnv are the Docker-related environment variables defined

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 SortMode

type SortMode uint16

SortMode represents allowed modes to sort a container slice

const (
	NoSort SortMode = iota
	SortByContainerID
	SortByImage
	SortByStatus
	SortByName
)

Allowed sort methods

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

Jump to

Keyboard shortcuts

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