dockerlib

package
v0.0.0-...-b33a62e Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2015 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocalIp

func GetLocalIp(server string) (string, error)

Get server's external ip address

Types

type APIContainers

type APIContainers struct {
	ID         string    `json:"ID"  binding:"required`
	Image      string    `json:"Image"  binding:"required"`
	Command    string    `json:"Command"`
	Created    int64     `json:"Created"`
	Status     string    `json:"Status"`
	Ports      []APIPort `json:"Ports"`
	SizeRw     int64     `json:"SizeRw"`
	SizeRootFs int64     `json:"SizeRootFs"`
	Names      string    `json:"Names"`
	DNS        string    `json:"Dns"`
	DNSSearch  string    `json:"DnsSearch"`
	Env        []string  `json:"Env"`
	Links      []string  `json:"Links"`
	Volume     []string  `json:"Volume"`
	Detach     bool      `json:"Detach"`
	User       string    `json:"User"`
	Workdir    string    `json:"Workdir"`
	Hostname   string    `json:"Hostname"`
	Privileged bool      `json:"Privileged"`
}

container struct

type APIImages

type APIImages struct {
	ID          string   `json:"Id"`
	RepoTags    []string `json:",omitempty"`
	Created     int64
	Size        int64
	VirtualSize int64
	ParentID    string `json:",omitempty"`
	Repository  string `json:",omitempty"`
	Tag         string `json:",omitempty"`
}

This work with api verion < v1.7 and > v1.9

type APIPort

type APIPort struct {
	PrivatePort int64
	PublicPort  int64
	Type        string
	IP          string
}

dockey port struct

type Error

type Error string // Error type

func (Error) Error

func (e Error) Error() string

type Lib

type Lib struct {
	Address string
	Cfg     []string
	Client  *docker.Client
	// pids    PidLib
	Localip string
}

Docker lib struct

func NewDockerLib

func NewDockerLib(address string) (Lib, error)

Get a DockerLib struct

func (*Lib) BuildImage

func (l *Lib) BuildImage(name string) (string, error)

build a docker image

func (*Lib) CleanContainers

func (l *Lib) CleanContainers() []string

Remove failed containers

func (*Lib) CleanImages

func (l *Lib) CleanImages() []string

Remove docker images without tag (headless images or garbage from build process)

func (*Lib) GetContainerCheckOpenPort

func (l *Lib) GetContainerCheckOpenPort(svcName string, port int) (bool, error)

Check if container has this port open

func (*Lib) GetContainerIpaddress

func (l *Lib) GetContainerIpaddress(svcName string) (string, error)

Get container's ip address in docker0

func (*Lib) GetContainerPorts

func (l *Lib) GetContainerPorts(svcName string) (map[docker.Port][]docker.PortBinding, error)

Get container ports

func (*Lib) GetContainerTcpPort

func (l *Lib) GetContainerTcpPort(svcName string, port int) (string, error)

Get container tcp port

func (*Lib) GetContainerUdpPort

func (l *Lib) GetContainerUdpPort(svcName string, port int) (string, error)

Get container udp port

func (*Lib) GetContainers

func (l *Lib) GetContainers(all bool) ([]APIContainers, error)

Get docker containers

func (*Lib) GetImages

func (l *Lib) GetImages() ([]APIImages, error)

Get local docker images

func (*Lib) ListImages

func (l *Lib) ListImages()

List local docker images

func (*Lib) PullImage

func (l *Lib) PullImage(name string) error

Pull docker image

func (*Lib) RemoveContainers

func (l *Lib) RemoveContainers(ids []string) error

Remove docker container

func (*Lib) RemoveImages

func (l *Lib) RemoveImages(ids []string) error

Remove docker images

func (*Lib) StartContainer

func (l *Lib) StartContainer(id string) error

start a container

func (*Lib) Status

func (l *Lib) Status()

Get status of all docker containers and images

Jump to

Keyboard shortcuts

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