6 "github.com/Sirupsen/logrus"
10 loggerCloseTimeout = 10 * time.Second
13 // Reset puts a container into a state where it can be restarted again.
14 func (container *Container) Reset(lock bool) {
17 defer container.Unlock()
20 if err := container.CloseStreams(); err != nil {
21 logrus.Errorf("%s: %s", container.ID, err)
24 // Re-create a brand new stdin pipe once the container exited
25 if container.Config.OpenStdin {
26 container.StreamConfig.NewInputPipes()
29 if container.LogDriver != nil {
30 if container.LogCopier != nil {
31 exit := make(chan struct{})
33 container.LogCopier.Wait()
37 case <-time.After(loggerCloseTimeout):
38 logrus.Warn("Logger didn't exit in time: logs may be truncated")
42 container.LogDriver.Close()
43 container.LogCopier = nil
44 container.LogDriver = nil