Set containerd as subreaper

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2017-03-09 16:26:14 -08:00
parent 6d3a70eb58
commit 61263bd77e
2 changed files with 9 additions and 0 deletions

View file

@ -44,6 +44,8 @@ type config struct {
Snapshotter string `toml:"snapshotter"` Snapshotter string `toml:"snapshotter"`
// Plugins provides plugin specific configuration for the initialization of a plugin // Plugins provides plugin specific configuration for the initialization of a plugin
Plugins map[string]toml.Primitive `toml:"plugins"` Plugins map[string]toml.Primitive `toml:"plugins"`
// Enable containerd as a subreaper
Subreaper bool `toml:"subreaper"`
md toml.MetaData md toml.MetaData
} }

View file

@ -23,6 +23,7 @@ import (
"github.com/docker/containerd/plugin" "github.com/docker/containerd/plugin"
"github.com/docker/containerd/reaper" "github.com/docker/containerd/reaper"
"github.com/docker/containerd/snapshot" "github.com/docker/containerd/snapshot"
"github.com/docker/containerd/sys"
"github.com/docker/containerd/utils" "github.com/docker/containerd/utils"
metrics "github.com/docker/go-metrics" metrics "github.com/docker/go-metrics"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -85,6 +86,12 @@ func main() {
// we don't miss any signals during boot // we don't miss any signals during boot
signals := make(chan os.Signal, 2048) signals := make(chan os.Signal, 2048)
signal.Notify(signals, syscall.SIGTERM, syscall.SIGINT, syscall.SIGUSR1, syscall.SIGCHLD) signal.Notify(signals, syscall.SIGTERM, syscall.SIGINT, syscall.SIGUSR1, syscall.SIGCHLD)
if conf.Subreaper {
log.G(global).Info("setting subreaper...")
if err := sys.SetSubreaper(1); err != nil {
return err
}
}
log.G(global).Info("starting containerd boot...") log.G(global).Info("starting containerd boot...")
// load all plugins into containerd // load all plugins into containerd