adoc

package module
v0.0.0-...-d3a8ad2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2018 License: MIT Imports: 23 Imported by: 7

README

Another DOcker Client in Go

ADOC is Another DOcker Client implemented in Go.

Supports:

  1. Docker 1.5/1.6 with remote api versions of 1.17, 1.18
  2. Add supports for Swarm, only minor differences with Docker API

Example:

	docker, err := adoc.NewDockerClient("tcp://<docker_tcp_port>", nil)

	// or you can pass the api version that you want to use
	docker, err := adoc.NewDockerClient("tcp://<docker_tcp_port>", nil, "1.18")
	
	// or you can use the swarm client
	docker, err := adoc.NewSwarmClient("tcp://<swarm_tcp_port>", nil)
	
	version, err := docker.Version()
	info, err := docker.Info()
	
	// create a container and start it
	containerConf := adoc.ContainerConfig{
		AttachStdout: true,
		AttachStderr: true,
		Cmd:          []string{"python", "app.py"},
		Image:        "training/webapp",
	}
	hostConf := adoc.HostConfig{
		PortBindings: map[string][]PortBinding{
			"5000/tcp": []PortBinding{
				PortBinding{},
			},
		},
	}
	id, err := docker.CreateContainer(containerConf, hostConf)
	err := docker.StartContainer(id)

	// Pull, inspect and remove an Image
	err := docker.PullImage("busybox", "latest")
	image, err := docker.InspectImage("busybox")
	err := docker.RemoveImage("busybox", false, false)
	
	// Monitor some stats from a running container
	monitorId := docker.MonitorStats(containerId, func(stats adoc.Stats, err error) {
		if err == nil {
			fmt.Println("Stats CpuUsage.PercpuUsage", stats.CpuStats.CpuUsage.PercpuUsage)
		}
	})
	time.Sleep(30 * time.Second)
	docker.StopMonitor(monitorId)
	
	// Polling some events happend since an hour agao until 5 minutes ago
	events, err := docker.EventsSince("", time.Hour, 5*time.Minute)
	
	// Or monitor all the events
	monitorId := docker.MonitorEvents("", func(event adoc.Event, err error) {
		if err == nil {
			fmt.Println("Event", event)
		}
	})
	time.Sleep(1 * time.Minute)
	docker.StopMonitor(monitorId)
	
	...
	

Documentation

Index

Constants

View Source
const (
	DockerEventCreate      = "create"
	DockerEventDestroy     = "destroy"
	DockerEventDie         = "die"
	DockerEventExecCreate  = "exec_create"
	DockerEventExecStart   = "exec_start"
	DockerEventExport      = "export"
	DockerEventKill        = "kill"
	DockerEventOOM         = "oom"
	DockerEventPause       = "pause"
	DockerEventRestart     = "restart"
	DockerEventStart       = "start"
	DockerEventStop        = "stop"
	DockerEventUnpause     = "unpause"
	DockerEventRename      = "rename"
	DockerEventImageUntag  = "untag"
	DockerEventImageDelete = "delete"

	// ContainerEventType is the event type that containers generate
	ContainerEventType = "container"
	// DaemonEventType is the event type that daemon generate
	DaemonEventType = "daemon"
	// ImageEventType is the event type that images generate
	ImageEventType = "image"
	// NetworkEventType is the event type that networks generate
	NetworkEventType = "network"
	// PluginEventType is the event type that plugins generate
	PluginEventType = "plugin"
	// VolumeEventType is the event type that volumes generate
	VolumeEventType = "volume"
)
View Source
const (
	KB = 1000
	MB = 1000 * KB
	GB = 1000 * MB
	TB = 1000 * GB
	PB = 1000 * TB

	KiB = 1024
	MiB = 1024 * KiB
	GiB = 1024 * MiB
	TiB = 1024 * GiB
	PiB = 1024 * TiB
)

See: http://en.wikipedia.org/wiki/Binary_prefix

View Source
const (
	ImagePuSecs = 100 * time.Second // 1000M / (10M/s)
)

Variables

View Source
var (
	ErrInvalidHeader = errors.New("Invalid header for docker log")
	ErrInvalidData   = errors.New("Invalid data for docker log")
)

Functions

func BytesSize

func BytesSize(size float64) string

func EnableDebug

func EnableDebug()

func EnableExitOnFatal

func EnableExitOnFatal()

func FromHumanSize

func FromHumanSize(size string) (int64, error)

FromHumanSize returns an integer from a human-readable specification of a size using SI standard (eg. "44kB", "17MB")

func HumanSize

func HumanSize(size float64) string

HumanSize returns a human-readable approximation of a size using SI standard (eg. "44kB", "17MB")

func IsNotFound

func IsNotFound(err error) bool

func IsServerInternalError

func IsServerInternalError(err error) bool

func ParseBytesSize

func ParseBytesSize(size string) (int64, error)

ParseBytesSize parse a string like "1.795 GiB" into an int64

func RAMInBytes

func RAMInBytes(size string) (int64, error)

RAMInBytes parses a human-readable string representing an amount of RAM in bytes, kibibytes, mebibytes, gibibytes, or tebibytes and returns the number of bytes, or -1 if the string is unparseable. Units are case-insensitive, and the 'b' suffix is optional.

func UnwrappedLogger

func UnwrappedLogger() *log.Logger

Types

type Actor

type Actor struct {
	ID         string
	Attributes map[string]string
}

Actor describes something that generates events, like a container, or a network, or a volume. It has a defined name and a set or attributes. The container attributes are its labels, other actors can generate these attributes from other properties.

type AuthConfig

type AuthConfig struct {
	UserName string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	Email    string `json:"email,omitempty"`
}

func (AuthConfig) Encode

func (auth AuthConfig) Encode() string

type BlkioStatEntry

type BlkioStatEntry struct {
	Major uint64 `json:"major"`
	Minor uint64 `json:"minor"`
	Op    string `json:"op"`
	Value uint64 `json:"value"`
}

type BlkioStats

type BlkioStats struct {
	IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive"`
	IoServicedRecursive     []BlkioStatEntry `json:"io_serviced_recursive"`
	IoQueuedRecursive       []BlkioStatEntry `json:"io_queue_recursive"`
	IoServiceTimeRecursive  []BlkioStatEntry `json:"io_service_time_recursive"`
	IoWaitTimeRecursive     []BlkioStatEntry `json:"io_wait_time_recursive"`
	IoMergedRecursive       []BlkioStatEntry `json:"io_merged_recursive"`
	IoTimeRecursive         []BlkioStatEntry `json:"io_time_recursive"`
	SectorsRecursive        []BlkioStatEntry `json:"sectors_recursive"`
}

type Container

type Container struct {
	Command    string
	Created    int64
	Id         string
	Image      string
	Labels     map[string]string
	Names      []string
	Ports      []Port
	SizeRootFs int64
	SizeRw     int64
	Status     string
}

Container defines basic container information for ListContainers

type ContainerConfig

type ContainerConfig struct {
	AttachStderr    bool
	AttachStdin     bool
	AttachStdout    bool
	Cmd             []string
	Domainname      string
	Entrypoint      []string
	Env             []string
	ExposedPorts    map[string]struct{}
	Healthcheck     *HealthConfig `json:",omitempty"`
	Hostname        string
	Image           string
	Labels          map[string]string
	MacAddress      string
	NetworkDisabled bool
	OnBuild         []string
	OpenStdin       bool
	PortSpecs       []string
	StdinOnce       bool
	Tty             bool
	User            string
	VolumeDriver    string
	Volumes         map[string]struct{}
	WorkingDir      string
}

ContainerConfig defines basic container creation data stucture

type ContainerDetail

type ContainerDetail struct {
	AppArmorProfile string
	Args            []string
	Config          ContainerConfig
	Created         time.Time
	Driver          string
	ExecDriver      string
	ExecIDs         []string
	GraphDriver     GraphDriverData
	HostConfig      HostConfig
	HostnamePath    string
	HostsPath       string
	Id              string
	Image           string
	LogPath         string
	MountLabel      string
	Name            string
	NetworkSettings NetworkSettings
	Path            string
	ProcessLabel    string
	ResolvConfPath  string
	RestartCount    int
	State           ContainerState
	Volumes         map[string]string
	VolumesRW       map[string]bool
	Node            SwarmNode // swarm api
}

ContainerDetail defines the detail data of the container from inspection, including the swarm node infor

type ContainerState

type ContainerState struct {
	Dead       bool
	Error      string
	ExitCode   int
	FinishedAt time.Time
	OOMKilled  bool
	Paused     bool
	Pid        int64
	Restarting bool
	Running    bool
	StartedAt  time.Time
	Health     *Health
}

ContainerState defines container running state from inspection

type CpuStats

type CpuStats struct {
	CpuUsage       CpuUsage       `json:"cpu_usage"`
	SystemUsage    uint64         `json:"system_cpu_usage"`
	ThrottlingData ThrottlingData `json:"throttling_data"`
}

type CpuUsage

type CpuUsage struct {
	TotalUsage        uint64   `json:"total_usage"`
	PercpuUsage       []uint64 `json:"percpu_usage"`
	UsageInKernelmode uint64   `json:"usage_in_kernelmode"`
	UsageInUsermode   uint64   `json:"usage_in_usermode"`
}

type Device

type Device struct {
	PathOnHost        string
	PathInContainer   string
	CgroupPermissions string
}

type DockerClient

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

func NewDockerClient

func NewDockerClient(daemonUrl string, tlsConfig *tls.Config, apiVersion ...string) (*DockerClient, error)

func NewDockerClientTimeout

func NewDockerClientTimeout(daemonUrl string, tlsConfig *tls.Config, timeout time.Duration, rwTimeout time.Duration, apiVersion ...string) (*DockerClient, error)

func NewSwarmClient

func NewSwarmClient(swarmUrl string, tlsConfig *tls.Config, apiVersion ...string) (*DockerClient, error)

func NewSwarmClientTimeout

func NewSwarmClientTimeout(swarmUrl string, tlsConfig *tls.Config, timeout time.Duration, rwTimeout time.Duration, apiVersion ...string) (*DockerClient, error)

func (*DockerClient) ConnectContainer

func (client *DockerClient) ConnectContainer(networkName string, id string, ipAddr string) error

func (*DockerClient) ContainerChanges

func (client *DockerClient) ContainerChanges(id string) ([]FsChange, error)

func (*DockerClient) ContainerLogs

func (client *DockerClient) ContainerLogs(id string, stdout, stderr, timestamps bool, tail ...int) ([]LogEntry, error)

func (*DockerClient) ContainerProcesses

func (client *DockerClient) ContainerProcesses(id string, psArgs ...string) (Processes, error)

func (*DockerClient) ContainerStats

func (client *DockerClient) ContainerStats(id string) (Stats, error)

func (*DockerClient) CreateContainer

func (client *DockerClient) CreateContainer(containerConf ContainerConfig, hostConf HostConfig, networkingConf NetworkingConfig, name ...string) (string, error)

func (*DockerClient) CreateExec

func (client *DockerClient) CreateExec(id string, execConfig ExecConfig) (string, error)

func (*DockerClient) DisconnectContainer

func (client *DockerClient) DisconnectContainer(networkName string, id string, force bool) error

func (*DockerClient) EventsSince

func (client *DockerClient) EventsSince(filters string, since time.Duration, until ...time.Duration) ([]Event, error)

func (*DockerClient) Info

func (client *DockerClient) Info() (DockerInfo, error)

func (*DockerClient) InspectContainer

func (client *DockerClient) InspectContainer(id string) (ContainerDetail, error)

InspectContainer returns container detail data with container id

func (*DockerClient) InspectImage

func (client *DockerClient) InspectImage(name string) (ImageDetail, error)

func (*DockerClient) IsSwarm

func (client *DockerClient) IsSwarm() bool

func (*DockerClient) KillContainer

func (client *DockerClient) KillContainer(id string, signal ...string) error

func (*DockerClient) ListContainers

func (client *DockerClient) ListContainers(showAll, showSize bool, filters ...string) ([]Container, error)

ListContainers returns containers data, showAll flag defines if you want to show all the containers including the stopped ones

func (*DockerClient) ListImages

func (client *DockerClient) ListImages(showAll bool, filters ...string) ([]Image, error)

func (*DockerClient) MonitorEvents

func (client *DockerClient) MonitorEvents(filters string, callback EventCallback) int64

func (*DockerClient) MonitorStats

func (client *DockerClient) MonitorStats(containerId string, callback StatsCallback) int64

func (*DockerClient) PauseContainer

func (client *DockerClient) PauseContainer(id string) error

func (*DockerClient) Ping

func (client *DockerClient) Ping() (bool, error)

func (*DockerClient) PullImage

func (client *DockerClient) PullImage(name string, tag string, authConfig ...AuthConfig) error

func (*DockerClient) PushImage

func (client *DockerClient) PushImage(name string, repo string, tag string, authConfig ...AuthConfig) error

func (*DockerClient) RemoveContainer

func (client *DockerClient) RemoveContainer(id string, force, volumes bool) error

func (*DockerClient) RemoveImage

func (client *DockerClient) RemoveImage(name string, force, noprune bool) error

func (*DockerClient) RenameContainer

func (client *DockerClient) RenameContainer(id string, name string) error

func (*DockerClient) RestartContainer

func (client *DockerClient) RestartContainer(id string, timeout ...int) error

func (*DockerClient) StartContainer

func (client *DockerClient) StartContainer(id string) error

func (*DockerClient) StartExec

func (client *DockerClient) StartExec(execId string, detach, tty bool) ([]byte, error)

func (*DockerClient) StopContainer

func (client *DockerClient) StopContainer(id string, timeout ...int) error

func (*DockerClient) StopMonitor

func (client *DockerClient) StopMonitor(monitorId int64)

func (*DockerClient) SwarmInfo

func (client *DockerClient) SwarmInfo() (SwarmInfo, error)

func (*DockerClient) TagImage

func (client *DockerClient) TagImage(name string, repo string, tag string, force bool) error

func (*DockerClient) UnpauseContainer

func (client *DockerClient) UnpauseContainer(id string) error

func (*DockerClient) UpdateContainer

func (client *DockerClient) UpdateContainer(id string, config interface{}) error

func (*DockerClient) Version

func (client *DockerClient) Version() (Version, error)

func (*DockerClient) WaitContainer

func (client *DockerClient) WaitContainer(id string) (int, error)

This will block the call routine until the container is stopped

type DockerInfo

type DockerInfo struct {
	Containers      int64
	DockerRootDir   string
	Driver          string
	DriverStatus    [][2]string
	SystemStatus    [][2]string
	ExecutionDriver string
	ID              string
	//IPv4Forwarding     int
	Images             int64
	IndexServerAddress string
	InitPath           string
	InitSha1           string
	KernelVersion      string
	Labels             []string
	MemTotal           int64
	//MemoryLimit        int
	NCPU            int64
	NEventsListener int64
	NFd             int64
	NGoroutines     int64
	Name            string
	OperatingSystem string
	//SwapLimit          int
	HttpProxy  string    // v1.18
	HttpsProxy string    // v1.18
	NoProxy    string    // v1.18
	SystemTime time.Time // v1.18

}

type EndpointConfig

type EndpointConfig struct {
	IPAMConfig IPAMConfig
}

type Error

type Error struct {
	StatusCode int
	Status     string
	Message    string
}

func (Error) Error

func (e Error) Error() string

type Event

type Event struct {
	// Deprecated information from JSONMessage.
	// With data only in container events.
	Status string `json:"status,omitempty"`
	ID     string `json:"id,omitempty"`
	From   string `json:"from,omitempty"`

	Type   string
	Action string
	Actor  Actor

	Time     int64 `json:"time,omitempty"`
	TimeNano int64 `json:"timeNano,omitempty"`

	Node SwarmNode `json:"node,omitempty"`
}

Message represents the information an event contains

type EventCallback

type EventCallback func(event Event, err error)

type ExecConfig

type ExecConfig struct {
	AttachStdin  bool
	AttachStdout bool
	AttachStderr bool
	Tty          bool
	Cmd          []string
}

type FsChange

type FsChange struct {
	Path string
	Kind int
}

type GraphDriverData

type GraphDriverData struct {
	// data
	// Required: true
	Data map[string]string `json:"Data"`
	// name
	// Required: true
	Name string `json:"Name"`
}

type Health

type Health struct {
	Status        string // Status is one of Starting, Healthy or Unhealthy
	FailingStreak int    // FailingStreak is the number of consecutive failures
}

type HealthConfig

type HealthConfig struct {
	// Test is the test to perform to check that the container is healthy.
	// An empty slice means to inherit the default.
	// The options are:
	// {} : inherit healthcheck
	// {"NONE"} : disable healthcheck
	// {"CMD", args...} : exec arguments directly
	// {"CMD-SHELL", command} : run command with system's default shell
	Test []string `json:",omitempty"`

	// Zero means to inherit. Durations are expressed as integer nanoseconds.
	Interval    time.Duration `json:",omitempty"` // Interval is the time to wait between checks.
	Timeout     time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung.
	StartPeriod time.Duration `json:",omitempty"` // The start period for the container to initialize before the retries starts to count down.

	// Retries is the number of consecutive failures needed to consider a container as unhealthy.
	// Zero means inherit.
	Retries int `json:",omitempty"`
}

type HostConfig

type HostConfig struct {
	Binds           []string
	CapAdd          []string
	CapDrop         []string
	ContainerIDFile string
	Dns             []string
	DnsSearch       []string
	ExtraHosts      []string
	IpcMode         string
	Links           []string
	LxcConf         []map[string]string
	NetworkMode     string
	PidMode         string
	PortBindings    map[string][]PortBinding
	Privileged      bool
	PublishAllPorts bool
	ReadonlyRootfs  bool
	RestartPolicy   RestartPolicy
	SecurityOpt     []string
	VolumesFrom     []string
	LogConfig       LogConfig // 1.18

	// Contains container's resources (cgroups, ulimits)
	Resources
}

HostConfig defines basic host configuration for container to run

type IPAMConfig

type IPAMConfig struct {
	IPv4Address string
	IPv6Address string
}

type Image

type Image struct {
	Created     int64
	Id          string
	Labels      map[string]string
	ParentId    string
	RepoTags    []string
	Size        int64
	VirtualSize int64
	RepoDigests []string // v1.18
}

type ImageDetail

type ImageDetail struct {
	Architecture    string
	Author          string
	Comment         string
	Container       string
	ContainerConfig ContainerConfig
	Created         time.Time
	DockerVersion   string
	Id              string
	Os              string
	Parent          string
	Size            int64
	VirtualSize     int64
}

type LogConfig

type LogConfig struct {
	Type   string
	Config map[string]string
}

type LogEntry

type LogEntry struct {
	Output  string
	Content string
}

func ReadAllDockerLogs

func ReadAllDockerLogs(reader io.Reader) ([]LogEntry, error)

func ReadOneDockerLog

func ReadOneDockerLog(reader io.Reader) (LogEntry, error)

type Logger

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

func (*Logger) Debug

func (l *Logger) Debug(v ...interface{})

func (*Logger) DebugV

func (l *Logger) DebugV(v interface{})

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

func (*Logger) Error

func (l *Logger) Error(v ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(v ...interface{})

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, v ...interface{})

func (*Logger) Info

func (l *Logger) Info(v ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...interface{})

func (*Logger) Warn

func (l *Logger) Warn(v ...interface{})

func (*Logger) Warnf

func (l *Logger) Warnf(format string, v ...interface{})

type MemoryStats

type MemoryStats struct {
	Usage    uint64            `json:"usage"`
	MaxUsage uint64            `json:"max_usage"`
	Stats    map[string]uint64 `json:"stats"`
	Failcnt  uint64            `json:"failcnt"`
	Limit    uint64            `json:"limit"`
}

type NetworkOptions

type NetworkOptions struct {
	Container      string
	EndpointConfig EndpointConfig
	Force          bool
}

type NetworkSettings

type NetworkSettings struct {
	Bridge                 string
	Gateway                string
	GlobalIPv6Address      string
	GlobalIPv6PrefixLen    int
	IPAddress              string
	IPPrefixLen            int
	IPv6Gateway            string
	LinkLocalIPv6Address   string
	LinkLocalIPv6PrefixLen int
	MacAddress             string
	Ports                  map[string][]PortBinding
	Networks               map[string]Networks
}

type NetworkStats

type NetworkStats struct {
	RxBytes   uint64 `json:"rx_bytes"`
	RxPackets uint64 `json:"rx_packets"`
	RxErrors  uint64 `json:"rx_errors"`
	RxDropped uint64 `json:"rx_dropped"`
	TxBytes   uint64 `json:"tx_bytes"`
	TxPackets uint64 `json:"tx_packets"`
	TxErrors  uint64 `json:"tx_errors"`
	TxDropped uint64 `json:"tx_dropped"`
}

type NetworkingConfig

type NetworkingConfig struct {
	EndpointsConfig map[string]EndpointConfig
}

type Networks

type Networks struct {
	Gateway   string
	IPAddress string
}

type Port

type Port struct {
	IP          string
	PrivatePort int
	PublicPort  int
	Type        string
}

type PortBinding

type PortBinding struct {
	HostIp   string
	HostPort string
}

type Processes

type Processes struct {
	Titles    []string
	Processes [][]string
}

type RequestConfig

type RequestConfig struct {
	ExtraTimeout time.Duration
}

type Resources

type Resources struct {
	// Applicable to all platforms
	CPUShares int64 `json:"CpuShares"` // CPU shares (relative weight vs. other containers)
	Memory    int64 // Memory limit (in bytes)

	// Applicable to UNIX platforms
	CgroupParent         string // Parent cgroup.
	BlkioWeight          uint16 // Block IO weight (relative weight vs. other containers)
	BlkioWeightDevice    []*WeightDevice
	BlkioDeviceReadBps   []*ThrottleDevice
	BlkioDeviceWriteBps  []*ThrottleDevice
	BlkioDeviceReadIOps  []*ThrottleDevice
	BlkioDeviceWriteIOps []*ThrottleDevice
	CPUPeriod            int64  `json:"CpuPeriod"` // CPU CFS (Completely Fair Scheduler) period
	CPUQuota             int64  `json:"CpuQuota"`  // CPU CFS (Completely Fair Scheduler) quota
	CpusetCpus           string // CpusetCpus 0-2, 0,1
	CpusetMems           string // CpusetMems 0-2, 0,1
	Devices              []Device
	DiskQuota            int64     // Disk limit (in bytes)
	KernelMemory         int64     // Kernel memory limit (in bytes)
	MemoryReservation    int64     // Memory soft limit (in bytes)
	MemorySwap           int64     // Total memory usage (memory + swap); set `-1` to enable unlimited swap
	MemorySwappiness     *int64    // Tuning container memory swappiness behaviour
	OomKillDisable       *bool     // Whether to disable OOM Killer or not
	PidsLimit            int64     // Setting pids limit for a container
	Ulimits              []*Ulimit // List of ulimits to be set in the container

	// Applicable to Windows
	CPUCount           int64  `json:"CpuCount"`   // CPU count
	CPUPercent         int64  `json:"CpuPercent"` // CPU percent
	IOMaximumIOps      uint64 // Maximum IOps for the container system drive
	IOMaximumBandwidth uint64 // Maximum IO in bytes per second for the container system drive
}

Resources contains container's resources (cgroups config, ulimits...)

type RestartPolicy

type RestartPolicy struct {
	MaximumRetryCount int
	Name              string
}

type Stats

type Stats struct {
	Read         time.Time    `json:"read"`
	NetworkStats NetworkStats `json:"network"`
	CpuStats     CpuStats     `json:"cpu_stats"`
	MemoryStats  MemoryStats  `json:"memory_stats"`
	BlkioStats   BlkioStats   `json:"blkio_stats"`
}

type StatsCallback

type StatsCallback func(stats Stats, err error)

type SwarmInfo

type SwarmInfo struct {
	Role       string
	Containers int64
	Strategy   string
	Filters    string
	Nodes      []SwarmNodeInfo
}

type SwarmNode

type SwarmNode struct {
	Name   string
	ID     string
	Addr   string
	IP     string
	Cpus   int
	Memory int64
	Labels map[string]string
}

SwarmNode defines the swarm api data for container running node

type SwarmNodeInfo

type SwarmNodeInfo struct {
	Name       string
	Address    string
	Containers int64
	CPUs       int
	UsedCPUs   int
	Memory     int64
	UsedMemory int64
}

type ThrottleDevice

type ThrottleDevice struct {
	Path string
	Rate uint64
}

ThrottleDevice is a structure that holds device:rate_per_second pair

func (*ThrottleDevice) String

func (t *ThrottleDevice) String() string

type ThrottlingData

type ThrottlingData struct {
	Periods          uint64 `json:"periods"`
	ThrottledPeriods uint64 `json:"throttled_periods"`
	ThrottledTime    uint64 `json:"throttled_time"`
}

type Ulimit

type Ulimit struct {
	Name string
	Soft int64
	Hard int64
}

type Version

type Version struct {
	ApiVersion    string
	GitCommit     string
	GoVersion     string
	Version       string
	Os            string // v1.18
	Arch          string // v1.18
	KernelVersion string // v1.18
}

type WeightDevice

type WeightDevice struct {
	Path   string
	Weight uint16
}

WeightDevice is a structure that holds device:weight pair

func (*WeightDevice) String

func (w *WeightDevice) String() string

Jump to

Keyboard shortcuts

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