From 728f8accc631c9ba7f7d989459509df668d916a5 Mon Sep 17 00:00:00 2001 From: rajasec Date: Fri, 14 Jul 2017 11:08:48 +0530 Subject: [PATCH] Fixing return error on run command Signed-off-by: rajasec Updating the usage and errors for ctr run command Signed-off-by: rajasec Updating the usage of run command Signed-off-by: rajasec Reverting back the imports Signed-off-by: rajasec --- cmd/ctr/run.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/ctr/run.go b/cmd/ctr/run.go index a33be55a9..5a4826150 100644 --- a/cmd/ctr/run.go +++ b/cmd/ctr/run.go @@ -47,7 +47,7 @@ func withMounts(context *cli.Context) containerd.SpecOpts { var runCommand = cli.Command{ Name: "run", Usage: "run a container", - ArgsUsage: "IMAGE ID [COMMAND] [ARG...]", + ArgsUsage: "IMAGE CONTAINER [COMMAND] [ARG...]", Flags: append([]cli.Flag{ cli.BoolFlag{ Name: "tty,t", @@ -94,10 +94,14 @@ var runCommand = cli.Command{ ctx, cancel = appContext(context) id = context.Args().Get(1) + imageRef = context.Args().First() tty = context.Bool("tty") ) defer cancel() + if imageRef == "" { + return errors.New("image ref must be provided") + } if id == "" { return errors.New("container id must be provided") }