Exemplo n.º 1
0
// StartContainer start a container
func (c *Cluster) StartContainer(container *cluster.Container) error {
	c.RLock()
	defer c.RUnlock()

	if err := container.Engine.StartContainer(container, nil); err != nil {
		return err
	}
	_, err := container.Refresh()
	return err
}
Exemplo n.º 2
0
// StartContainer start a container
func (c *Cluster) StartContainer(container *cluster.Container) error {
	c.RLock()
	defer c.RUnlock()

	if container, _ := container.Refresh(); container != nil {
		// As mesos garbage collect containers, we only allow starting on a "Created" containers
		if container.Info.State.Running == false && container.Info.State.FinishedAt.IsZero() {
			if err := container.Engine.StartContainer(container, nil); err != nil {
				_, err = container.Refresh()
				return err
			}
		}
	}
	return nil
}