Merge pull request #606 from vburenin/user-runtime-option
Added new --runtime option for 'ctr run' to specify user defined runtime.
This commit is contained in:
		
						commit
						328e30dc67
					
				
					 1 changed files with 8 additions and 5 deletions
				
			
		|  | @ -1,12 +1,10 @@ | ||||||
| package main | package main | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
|  | 	gocontext "context" | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"io/ioutil" | 	"io/ioutil" | ||||||
| 	"path/filepath" | 	"path/filepath" | ||||||
| 
 |  | ||||||
| 	gocontext "context" |  | ||||||
| 
 |  | ||||||
| 	"runtime" | 	"runtime" | ||||||
| 
 | 
 | ||||||
| 	"github.com/Sirupsen/logrus" | 	"github.com/Sirupsen/logrus" | ||||||
|  | @ -15,8 +13,8 @@ import ( | ||||||
| 	"github.com/docker/containerd/api/types/mount" | 	"github.com/docker/containerd/api/types/mount" | ||||||
| 	protobuf "github.com/gogo/protobuf/types" | 	protobuf "github.com/gogo/protobuf/types" | ||||||
| 	"github.com/opencontainers/runtime-spec/specs-go" | 	"github.com/opencontainers/runtime-spec/specs-go" | ||||||
| 	"github.com/urfave/cli" |  | ||||||
| 	"github.com/pkg/errors" | 	"github.com/pkg/errors" | ||||||
|  | 	"github.com/urfave/cli" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| var rwm = "rwm" | var rwm = "rwm" | ||||||
|  | @ -171,6 +169,11 @@ var runCommand = cli.Command{ | ||||||
| 			Name:  "runtime-config", | 			Name:  "runtime-config", | ||||||
| 			Usage: "custom runtime config (config.json)", | 			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 { | 	Action: func(context *cli.Context) error { | ||||||
| 		id := context.String("id") | 		id := context.String("id") | ||||||
|  | @ -222,7 +225,7 @@ var runCommand = cli.Command{ | ||||||
| 				Value:   data, | 				Value:   data, | ||||||
| 			}, | 			}, | ||||||
| 			Rootfs:   rootfs, | 			Rootfs:   rootfs, | ||||||
| 			Runtime:  "linux", | 			Runtime:  context.String("runtime"), | ||||||
| 			Terminal: context.Bool("tty"), | 			Terminal: context.Bool("tty"), | ||||||
| 			Stdin:    filepath.Join(tmpDir, "stdin"), | 			Stdin:    filepath.Join(tmpDir, "stdin"), | ||||||
| 			Stdout:   filepath.Join(tmpDir, "stdout"), | 			Stdout:   filepath.Join(tmpDir, "stdout"), | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue