From 71870d7631f67526aee48b26bb7a960aa18cbfb6 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Thu, 30 Mar 2017 09:26:33 +0000 Subject: [PATCH] ctr/run: revive specifying custom command e.g. $ ctr run --id foo docker.io/library/busybox:latest ls Signed-off-by: Akihiro Suda --- cmd/ctr/run.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/ctr/run.go b/cmd/ctr/run.go index ce2a959..e72957f 100644 --- a/cmd/ctr/run.go +++ b/cmd/ctr/run.go @@ -51,8 +51,13 @@ func spec(id string, config *ocispec.ImageConfig, context *cli.Context) (*specs. "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", } env = append(env, config.Env...) + cmd := config.Cmd + if v := context.Args().Tail(); len(v) > 0 { + cmd = v + } var ( - args = append(config.Entrypoint, config.Cmd...) + // TODO: support overriding entrypoint + args = append(config.Entrypoint, cmd...) tty = context.Bool("tty") uid, gid uint32 ) @@ -214,8 +219,9 @@ func spec(id string, config *ocispec.ImageConfig, context *cli.Context) (*specs. } var runCommand = cli.Command{ - Name: "run", - Usage: "run a container", + Name: "run", + Usage: "run a container", + ArgsUsage: "IMAGE [COMMAND] [ARG...]", Flags: []cli.Flag{ cli.StringFlag{ Name: "id",