Merge pull request #1178 from rajasec/ctr-run-error
Fixing return error on run command
This commit is contained in:
commit
805654abc7
@ -47,7 +47,7 @@ func withMounts(context *cli.Context) containerd.SpecOpts {
|
|||||||
var runCommand = cli.Command{
|
var runCommand = cli.Command{
|
||||||
Name: "run",
|
Name: "run",
|
||||||
Usage: "run a container",
|
Usage: "run a container",
|
||||||
ArgsUsage: "IMAGE ID [COMMAND] [ARG...]",
|
ArgsUsage: "IMAGE CONTAINER [COMMAND] [ARG...]",
|
||||||
Flags: append([]cli.Flag{
|
Flags: append([]cli.Flag{
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "tty,t",
|
Name: "tty,t",
|
||||||
@ -94,10 +94,14 @@ var runCommand = cli.Command{
|
|||||||
|
|
||||||
ctx, cancel = appContext(context)
|
ctx, cancel = appContext(context)
|
||||||
id = context.Args().Get(1)
|
id = context.Args().Get(1)
|
||||||
|
imageRef = context.Args().First()
|
||||||
tty = context.Bool("tty")
|
tty = context.Bool("tty")
|
||||||
)
|
)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
if imageRef == "" {
|
||||||
|
return errors.New("image ref must be provided")
|
||||||
|
}
|
||||||
if id == "" {
|
if id == "" {
|
||||||
return errors.New("container id must be provided")
|
return errors.New("container id must be provided")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user