Documentation ¶
Index ¶
- Variables
- func GetEth0Ip() ([]string, error)
- func ImageEquals(a, b interface{}) bool
- func ImageLessBySemanticVersion(a, b interface{}) bool
- func ParseDockerImage(dockerImage string) (repo, tag string, err error)
- type Action
- type AuthIdentity
- type Container
- type ContainerCollection
- func (cg *ContainerCollection) Add(c *Container) *fsm.Fsm
- func (cg *ContainerCollection) Empty() bool
- func (c ContainerCollection) GetKey() interface{}
- func (c ContainerCollection) Instances() []*fsm.Fsm
- func (cg *ContainerCollection) Remove(c *Container)
- func (c ContainerCollection) String() string
- type ContainerControl
- type ContainerState
- type Docker
- func (c *Docker) FindContainers(filter map[string][]string) ([]*Container, error)
- func (c *Docker) FindContainersByName(name string) ([]*Container, error)
- func (c *Docker) ListContainers() ([]*Container, error)
- func (c *Docker) PullImage(auth *AuthIdentity, image *Image) (<-chan error, error)
- func (c *Docker) RemoveContainer(auth *AuthIdentity, id string, removeVolumes, force bool) error
- func (c *Docker) RemoveImage(image string, force, prune bool) error
- func (c *Docker) StartContainer(auth *AuthIdentity, ct *ContainerControl) (*Container, error)
- func (c *Docker) StopContainer(auth *AuthIdentity, id string, timeout time.Duration) error
- func (c *Docker) WatchContainer(notify func(Action, *Container)) (chan<- bool, error)
- func (c *Docker) WatchContainerMatching(accept func(Action, *Container) bool, notify func(Action, *Container)) (chan<- bool, error)
- type Image
- type Port
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ContainerFsm = containerFsm{ Created: []State{Starting, Running, Failed, Stopped, Removed}, Starting: []State{Running, Failed, Stopping}, Running: []State{Running, Failed, Stopping, Stopped}, Stopping: []State{Failed, Stopped}, Stopped: []State{Removed}, Failed: []State{Removed}, } )
Functions ¶
func GetEth0Ip ¶
Note that this depends on the context in which it is run. If this is run from the host (outside container), then it will return the address at eth0, but if it's run from inside a container, the eth0 interface is actually the docker0 interface on the host.
func ImageEquals ¶
func ImageEquals(a, b interface{}) bool
func ImageLessBySemanticVersion ¶
func ImageLessBySemanticVersion(a, b interface{}) bool
func ParseDockerImage ¶
Types ¶
type AuthIdentity ¶
type AuthIdentity struct {
docker.AuthConfiguration
}
type Container ¶
type Container struct { Id string `json:"id"` Ip string `json:"ip"` Image string `json:"image"` ImageId string `json:"image_id"` Name string `json:"name"` Command string `json:"command"` Ports []Port `json:"ports"` Network docker.NetworkSettings DockerData *docker.Container `json:"docker_data"` // contains filtered or unexported fields }
func (*Container) GetComparable ¶
type ContainerCollection ¶
For all instances of a same container image version.
func NewContainerCollection ¶
func NewContainerCollection(image string) *ContainerCollection
func (*ContainerCollection) Empty ¶
func (cg *ContainerCollection) Empty() bool
func (ContainerCollection) GetKey ¶
func (c ContainerCollection) GetKey() interface{}
func (ContainerCollection) Instances ¶
func (c ContainerCollection) Instances() []*fsm.Fsm
func (*ContainerCollection) Remove ¶
func (cg *ContainerCollection) Remove(c *Container)
func (ContainerCollection) String ¶
func (c ContainerCollection) String() string
type ContainerControl ¶
type ContainerState ¶
type ContainerState int
const ( Created ContainerState = iota Starting Running // ready running Stopping // initiated stop Stopped // stopped Failed // uninitiated / unexpected stop Removed // removed )
func (ContainerState) Equals ¶
func (this ContainerState) Equals(that State) bool
func (ContainerState) String ¶
func (this ContainerState) String() string
type Docker ¶
type Docker struct { Endpoint string Cert string Key string Ca string ContainerCreated func(*Container) ContainerStarted func(*Container) // contains filtered or unexported fields }
func NewTLSClient ¶
Endpoint and file paths
func (*Docker) FindContainers ¶
func (*Docker) FindContainersByName ¶
func (*Docker) ListContainers ¶
func (*Docker) PullImage ¶
func (c *Docker) PullImage(auth *AuthIdentity, image *Image) (<-chan error, error)
func (*Docker) RemoveContainer ¶
func (c *Docker) RemoveContainer(auth *AuthIdentity, id string, removeVolumes, force bool) error
func (*Docker) StartContainer ¶
func (c *Docker) StartContainer(auth *AuthIdentity, ct *ContainerControl) (*Container, error)
func (*Docker) StopContainer ¶
func (*Docker) WatchContainer ¶
type Image ¶
type Image struct { Registry string `json:"registry"` Repository string `json:"repository"` Tag string `json:"tag"` }
func ParseImageUrl ¶
func (Image) ImageString ¶
Click to show internal directories.
Click to hide internal directories.