Skip to content

Commit

Permalink
executor: use a custom InitPath initializer
Browse files Browse the repository at this point in the history
Use a custom initializer that enables us to use upstream runc, rather
than our fork.

Until opencontainers/runc#1888 is merged.
  • Loading branch information
Mahmood Ali committed Mar 18, 2019
1 parent b4c55b1 commit dcb25ba
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion drivers/shared/executor/executor_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (l *LibcontainerExecutor) Launch(command *ExecCommand) (*ProcessState, erro
factory, err := libcontainer.New(
path.Join(command.TaskDir, "../alloc/container"),
libcontainer.Cgroupfs,
libcontainer.InitArgs(bin, "libcontainer-shim"),
libcontainerInitArgs(bin, "libcontainer-shim"),
)
if err != nil {
return nil, fmt.Errorf("failed to create factory: %v", err)
Expand Down Expand Up @@ -763,3 +763,26 @@ func cmdMounts(mounts []*drivers.MountConfig) []*lconfigs.Mount {

return r
}

// libcontainerInitArgs returns an options func to configure a LinuxFactory with the
// provided init binary path and arguments.
//
// Workaround open PR https://github.com/opencontainers/runc/pull/1888
// remove when PR is merged
func libcontainerInitArgs(args ...string) func(*libcontainer.LinuxFactory) error {
return func(l *libcontainer.LinuxFactory) (err error) {
if len(args) > 0 {
// Resolve relative paths to ensure that its available
// after directory changes.
if args[0], err = filepath.Abs(args[0]); err != nil {
return fmt.Errorf("Invalid configuration: %v", err)
}
}

l.InitPath = args[0]
if len(args) > 1 {
l.InitArgs = args[1:]
}
return nil
}
}

0 comments on commit dcb25ba

Please sign in to comment.