client

package
v0.0.0-...-ad62554 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2016 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetShortID

func GetShortID(dockerID string) (string, error)

GetShortID returns short container ID (12 chars)

Types

type DockerClient

type DockerClient struct {
	// contains filtered or unexported fields
}

DockerClient holds fsouza go-dockerclient instance ready for communication with the server endpoint `unix:///var/run/docker.sock`, cache instance which is used to store output from docker container inspect (to avoid execute inspect request multiply times, it is called only once per container) and diskUsageCollector which is responsible for collecting container disk usage (based on `du -u` command) in the background

func NewDockerClient

func NewDockerClient() (*DockerClient, error)

NewDockerClient returns dockerClient instance ready for communication with the server endpoint `unix:///var/run/docker.sock`

func (*DockerClient) FindCgroupMountpoint

func (dc *DockerClient) FindCgroupMountpoint(subsystem string) (string, error)

FindCgroupMountpoint returns cgroup mountpoint of a given subsystem

func (*DockerClient) GetStatsFromContainer

func (dc *DockerClient) GetStatsFromContainer(id string, collectFs bool) (*wrapper.Statistics, error)

GetStatsFromContainer returns docker containers stats: cgroups stats (cpu usage, memory usage, etc.) and network stats (tx_bytes, rx_bytes etc.); notes that incoming container id has to be full-length to be able to inspect container

func (*DockerClient) InspectContainer

func (dc *DockerClient) InspectContainer(id string) (*docker.Container, error)

InspectContainer returns information about the container with given ID

func (*DockerClient) ListContainersAsMap

func (dc *DockerClient) ListContainersAsMap() (map[string]docker.APIContainers, error)

ListContainersAsMap returns list of all available docker containers and base information about them (status, uptime, etc.)

type DockerClientInterface

type DockerClientInterface interface {
	ListContainersAsMap() (map[string]docker.APIContainers, error)
	GetStatsFromContainer(string, bool) (*wrapper.Statistics, error)
	InspectContainer(string) (*docker.Container, error)
	FindCgroupMountpoint(string) (string, error)
}

DockerClientInterface provides methods i.a. for interaction with the docker API.

Jump to

Keyboard shortcuts

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