Support runtime specific configurations.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2018-10-08 13:39:05 -07:00
parent e4f33828c3
commit 1442425f92
9 changed files with 257 additions and 121 deletions

View File

@@ -108,8 +108,14 @@ func (c *criService) startContainer(ctx context.Context,
return cntr.IO, nil
}
ctrInfo, err := container.Info(ctx)
if err != nil {
return errors.Wrap(err, "failed to get container info")
}
var taskOpts []containerd.NewTaskOpts
if c.config.NoPivot {
// TODO(random-liu): Remove this after shim v1 is deprecated.
if c.config.NoPivot && ctrInfo.Runtime.Name == linuxRuntime {
taskOpts = append(taskOpts, containerd.WithNoPivotRoot)
}
task, err := container.NewTask(ctx, ioCreation, taskOpts...)