Implement proper shutdown logic

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2015-12-04 13:31:17 -08:00
parent a10aa91051
commit c10b3cde9f
6 changed files with 67 additions and 20 deletions

View File

@@ -86,8 +86,11 @@ func daemon(stateDir string, concurrency, bufferSize int) error {
w := containerd.NewWorker(supervisor, wg)
go w.Start()
}
if err := setSubReaper(); err != nil {
return err
// only set containerd as the subreaper if it is not an init process
if pid := os.Getpid(); pid != 1 {
if err := setSubReaper(); err != nil {
return err
}
}
// start the signal handler in the background.
go startSignalHandler(supervisor, bufferSize)