Set the started time for a container

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
Mrunal Patel 2016-09-12 15:43:11 -07:00
parent b145b16ac0
commit 0741159ce8

View file

@ -73,7 +73,11 @@ func (r *Runtime) CreateContainer(c *Container) error {
// StartContainer starts a container.
func (r *Runtime) StartContainer(c *Container) error {
return utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, r.path, "start", c.name)
if err := utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, r.path, "start", c.name); err != nil {
return err
}
c.state.Started = time.Now()
return nil
}
// StopContainer stops a container.
@ -119,6 +123,7 @@ type Container struct {
type ContainerState struct {
specs.State
Created time.Time `json:"created"`
Started time.Time `json:"started"`
}
// NewContainer creates a container object.