mirror of
https://github.com/docker/docs.git
synced 2026-04-04 02:08:57 +07:00
At startup, inspect all containers and store the data into the Container. When new containers are detected, inspect them as well. Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
39 lines
742 B
Go
39 lines
742 B
Go
package libcluster
|
|
|
|
import "github.com/samalba/dockerclient"
|
|
|
|
type Container struct {
|
|
dockerclient.Container
|
|
|
|
Info dockerclient.ContainerInfo
|
|
node *Node
|
|
}
|
|
|
|
func (c *Container) Node() *Node {
|
|
return c.node
|
|
}
|
|
|
|
func (c *Container) Start() error {
|
|
return c.node.client.StartContainer(c.Id, nil)
|
|
}
|
|
|
|
func (c *Container) Kill(sig int) error {
|
|
return c.node.client.KillContainer(c.Id)
|
|
}
|
|
|
|
func (c *Container) Stop() error {
|
|
return c.node.client.StopContainer(c.Id, 8)
|
|
}
|
|
|
|
func (c *Container) Restart(timeout int) error {
|
|
return c.node.client.RestartContainer(c.Id, timeout)
|
|
}
|
|
|
|
func (c *Container) Pause() error {
|
|
return c.node.client.PauseContainer(c.Id)
|
|
}
|
|
|
|
func (c *Container) Unpause() error {
|
|
return c.node.client.UnpauseContainer(c.Id)
|
|
}
|