From 2972f2728f5c69ca5a0635a5da8bac3ae277d513 Mon Sep 17 00:00:00 2001 From: Volodymyr Burenin Date: Mon, 6 Mar 2017 13:07:29 -0600 Subject: [PATCH] Added new flag for 'ctr run' to specify user defined runtime. Signed-off-by: Volodymyr Burenin --- cmd/ctr/run.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/ctr/run.go b/cmd/ctr/run.go index bc0db65..2fbc0ff 100644 --- a/cmd/ctr/run.go +++ b/cmd/ctr/run.go @@ -1,12 +1,10 @@ package main import ( + gocontext "context" "encoding/json" "io/ioutil" "path/filepath" - - gocontext "context" - "runtime" "github.com/Sirupsen/logrus" @@ -15,8 +13,8 @@ import ( "github.com/docker/containerd/api/types/mount" protobuf "github.com/gogo/protobuf/types" "github.com/opencontainers/runtime-spec/specs-go" - "github.com/urfave/cli" "github.com/pkg/errors" + "github.com/urfave/cli" ) var rwm = "rwm" @@ -171,6 +169,11 @@ var runCommand = cli.Command{ Name: "runtime-config", Usage: "custom runtime config (config.json)", }, + cli.StringFlag{ + Name: "runtime", + Usage: "runtime name (linux, windows, vmware-linux)", + Value: "linux", + }, }, Action: func(context *cli.Context) error { id := context.String("id") @@ -222,7 +225,7 @@ var runCommand = cli.Command{ Value: data, }, Rootfs: rootfs, - Runtime: "linux", + Runtime: context.String("runtime"), Terminal: context.Bool("tty"), Stdin: filepath.Join(tmpDir, "stdin"), Stdout: filepath.Join(tmpDir, "stdout"),