Move StartedAt time to before starting the container

Signed-off-by: Lars Andringa <l.s.andringa@rug.nl>
Signed-off-by: LarsSven <l.s.andringa@rug.nl>

Replaced boolean parameter by IsZero check

Signed-off-by: LarsSven <l.s.andringa@rug.nl>

Separated SetRunning into two functions

Signed-off-by: LarsSven <l.s.andringa@rug.nl>

Apply suggestions from code review

Documentation fixes

Co-authored-by: Paweł Gronowski <me@woland.xyz>
Signed-off-by: LarsSven <l.s.andringa@rug.nl>
This commit is contained in:
Lars Andringa
2023-12-30 15:32:53 +01:00
committed by LarsSven
parent 341e7b35a6
commit d4f61f92fd
6 changed files with 25 additions and 13 deletions

View File

@@ -199,6 +199,7 @@ func (daemon *Daemon) containerStart(ctx context.Context, daemonCfg *configStore
return setExitCodeFromError(container.SetExitCode, err)
}
startupTime := time.Now()
// TODO(mlaventure): we need to specify checkpoint options here
tsk, err := ctr.Start(context.TODO(), // Passing ctx to ctr.Start caused integration tests to be stuck in the cleanup phase
checkpointDir, container.StreamConfig.Stdin() != nil || container.Config.Tty,
@@ -212,7 +213,7 @@ func (daemon *Daemon) containerStart(ctx context.Context, daemonCfg *configStore
}
container.HasBeenManuallyRestarted = false
container.SetRunning(ctr, tsk, true)
container.SetRunning(ctr, tsk, startupTime)
container.HasBeenStartedBefore = true
daemon.setStateCounter(container)