Merge pull request #47003 from LarsSven/fix-container-start-time

Move StartedAt time to before starting the container
This commit is contained in:
Paweł Gronowski
2024-05-07 14:58:27 +02:00
committed by GitHub
6 changed files with 25 additions and 13 deletions

View File

@@ -179,6 +179,7 @@ func (daemon *Daemon) containerStart(ctx context.Context, daemonCfg *configStore
}
}()
startupTime := time.Now()
// TODO(mlaventure): we need to specify checkpoint options here
tsk, err := ctr.NewTask(context.TODO(), // Passing ctx caused integration tests to be stuck in the cleanup phase
checkpointDir, container.StreamConfig.Stdin() != nil || container.Config.Tty,
@@ -204,7 +205,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)