Merge pull request #1328 from crosbymichael/ctr-runtime
Set runtime on container from ctr
This commit is contained in:
commit
70c2d367db
@ -2,6 +2,8 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
gocontext "context"
|
gocontext "context"
|
||||||
|
"fmt"
|
||||||
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/containerd/console"
|
"github.com/containerd/console"
|
||||||
@ -56,7 +58,7 @@ var runCommand = cli.Command{
|
|||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "runtime",
|
Name: "runtime",
|
||||||
Usage: "runtime name (io.containerd.runtime.v1.linux, io.containerd.runtime.v1.windows, io.containerd.runtime.v1.com.vmware.linux)",
|
Usage: "runtime name (io.containerd.runtime.v1.linux, io.containerd.runtime.v1.windows, io.containerd.runtime.v1.com.vmware.linux)",
|
||||||
Value: "io.containerd.runtime.v1.linux",
|
Value: fmt.Sprintf("io.containerd.runtime.v1.%s", runtime.GOOS),
|
||||||
},
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "readonly",
|
Name: "readonly",
|
||||||
|
@ -99,6 +99,7 @@ func newContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
|||||||
cOpts = append(cOpts, containerd.WithNewSnapshot(id, image))
|
cOpts = append(cOpts, containerd.WithNewSnapshot(id, image))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cOpts = append(cOpts, containerd.WithRuntime(context.String("runtime")))
|
||||||
|
|
||||||
opts = append(opts, withEnv(context), withMounts(context))
|
opts = append(opts, withEnv(context), withMounts(context))
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
|
@ -117,6 +117,7 @@ func newContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
|||||||
return client.NewContainer(ctx, id,
|
return client.NewContainer(ctx, id,
|
||||||
containerd.WithSpec(spec),
|
containerd.WithSpec(spec),
|
||||||
containerd.WithContainerLabels(labels),
|
containerd.WithContainerLabels(labels),
|
||||||
|
containerd.WithRuntime(context.String("runtime")),
|
||||||
// TODO(mlaventure): containerd.WithImage(image),
|
// TODO(mlaventure): containerd.WithImage(image),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user