Add reaper code for daemon
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
4fd2478513
commit
df48983fe7
4 changed files with 109 additions and 5 deletions
|
@ -38,7 +38,7 @@ type Config struct {
|
|||
Runtime string `toml:"runtime"`
|
||||
}
|
||||
|
||||
func New(ic *containerd.InitContext) (interface{}, error) {
|
||||
func New(ic *plugin.InitContext) (interface{}, error) {
|
||||
path := filepath.Join(ic.State, runtimeName)
|
||||
if err := os.MkdirAll(path, 0700); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
"google.golang.org/grpc/grpclog"
|
||||
|
||||
"github.com/docker/containerd/api/services/shim"
|
||||
"github.com/docker/containerd/reaper"
|
||||
"github.com/docker/containerd/utils"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
@ -41,11 +42,9 @@ func newShim(path string) (shim.ShimClient, error) {
|
|||
Cloneflags: syscall.CLONE_NEWNS,
|
||||
Setpgid: true,
|
||||
}
|
||||
if err := cmd.Start(); err != nil {
|
||||
if err := reaper.Default.Start(cmd); err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to start shim")
|
||||
}
|
||||
// since we are currently the parent go ahead and make sure we wait on the shim
|
||||
go cmd.Wait()
|
||||
return connectShim(socket)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue