8232312c1e
Move some calls to container.LogEvent down lower so that there's less of a chance of them being missed. Also add a few more events that appear to have been missed. Added testcases for new events: commit, copy, resize, attach, rename, top Signed-off-by: Doug Davis <dug@us.ibm.com>
40 lines
869 B
Go
40 lines
869 B
Go
package daemon
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/docker/docker/runconfig"
|
|
)
|
|
|
|
func (daemon *Daemon) ContainerStart(name string, hostConfig *runconfig.HostConfig) error {
|
|
container, err := daemon.Get(name)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if container.IsPaused() {
|
|
return fmt.Errorf("Cannot start a paused container, try unpause instead.")
|
|
}
|
|
|
|
if container.IsRunning() {
|
|
return fmt.Errorf("Container already started")
|
|
}
|
|
|
|
if _, err = daemon.verifyHostConfig(hostConfig); err != nil {
|
|
return err
|
|
}
|
|
|
|
// This is kept for backward compatibility - hostconfig should be passed when
|
|
// creating a container, not during start.
|
|
if hostConfig != nil {
|
|
if err := daemon.setHostConfig(container, hostConfig); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
if err := container.Start(); err != nil {
|
|
return fmt.Errorf("Cannot start container %s: %s", name, err)
|
|
}
|
|
|
|
return nil
|
|
}
|