|
@@ -13,7 +13,6 @@ import (
|
|
"syscall"
|
|
"syscall"
|
|
"time"
|
|
"time"
|
|
|
|
|
|
- "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options"
|
|
|
|
"github.com/containerd/containerd"
|
|
"github.com/containerd/containerd"
|
|
apievents "github.com/containerd/containerd/api/events"
|
|
apievents "github.com/containerd/containerd/api/events"
|
|
"github.com/containerd/containerd/api/types"
|
|
"github.com/containerd/containerd/api/types"
|
|
@@ -28,7 +27,6 @@ import (
|
|
"github.com/docker/docker/errdefs"
|
|
"github.com/docker/docker/errdefs"
|
|
"github.com/docker/docker/libcontainerd/queue"
|
|
"github.com/docker/docker/libcontainerd/queue"
|
|
libcontainerdtypes "github.com/docker/docker/libcontainerd/types"
|
|
libcontainerdtypes "github.com/docker/docker/libcontainerd/types"
|
|
-
|
|
|
|
"github.com/docker/docker/pkg/ioutils"
|
|
"github.com/docker/docker/pkg/ioutils"
|
|
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
|
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
|
@@ -192,6 +190,27 @@ func (c *client) Start(ctx context.Context, id, checkpointDir string, withStdin
|
|
}
|
|
}
|
|
bundle := labels[DockerContainerBundlePath]
|
|
bundle := labels[DockerContainerBundlePath]
|
|
uid, gid := getSpecUser(spec)
|
|
uid, gid := getSpecUser(spec)
|
|
|
|
+
|
|
|
|
+ taskOpts := []containerd.NewTaskOpts{
|
|
|
|
+ func(_ context.Context, _ *containerd.Client, info *containerd.TaskInfo) error {
|
|
|
|
+ info.Checkpoint = cp
|
|
|
|
+ return nil
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if runtime.GOOS != "windows" {
|
|
|
|
+ taskOpts = append(taskOpts, func(_ context.Context, _ *containerd.Client, info *containerd.TaskInfo) error {
|
|
|
|
+ info.Options = &runctypes.CreateOptions{
|
|
|
|
+ IoUid: uint32(uid),
|
|
|
|
+ IoGid: uint32(gid),
|
|
|
|
+ NoPivotRoot: os.Getenv("DOCKER_RAMDISK") != "",
|
|
|
|
+ }
|
|
|
|
+ return nil
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ taskOpts = append(taskOpts, withLogLevel(c.logger.Level))
|
|
|
|
+ }
|
|
|
|
+
|
|
t, err = ctr.NewTask(ctx,
|
|
t, err = ctr.NewTask(ctx,
|
|
func(id string) (cio.IO, error) {
|
|
func(id string) (cio.IO, error) {
|
|
fifos := newFIFOSet(bundle, libcontainerdtypes.InitProcessName, withStdin, spec.Process.Terminal)
|
|
fifos := newFIFOSet(bundle, libcontainerdtypes.InitProcessName, withStdin, spec.Process.Terminal)
|
|
@@ -199,22 +218,8 @@ func (c *client) Start(ctx context.Context, id, checkpointDir string, withStdin
|
|
rio, err = c.createIO(fifos, id, libcontainerdtypes.InitProcessName, stdinCloseSync, attachStdio)
|
|
rio, err = c.createIO(fifos, id, libcontainerdtypes.InitProcessName, stdinCloseSync, attachStdio)
|
|
return rio, err
|
|
return rio, err
|
|
},
|
|
},
|
|
- func(_ context.Context, _ *containerd.Client, info *containerd.TaskInfo) error {
|
|
|
|
- info.Checkpoint = cp
|
|
|
|
- if runtime.GOOS != "windows" {
|
|
|
|
- info.Options = &runctypes.CreateOptions{
|
|
|
|
- IoUid: uint32(uid),
|
|
|
|
- IoGid: uint32(gid),
|
|
|
|
- NoPivotRoot: os.Getenv("DOCKER_RAMDISK") != "",
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- // Make sure we set the runhcs options to debug if we are at debug level.
|
|
|
|
- if c.logger.Level == logrus.DebugLevel {
|
|
|
|
- info.Options = &options.Options{Debug: true}
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return nil
|
|
|
|
- })
|
|
|
|
|
|
+ taskOpts...,
|
|
|
|
+ )
|
|
if err != nil {
|
|
if err != nil {
|
|
close(stdinCloseSync)
|
|
close(stdinCloseSync)
|
|
if rio != nil {
|
|
if rio != nil {
|