ctr/run: revive specifying custom command
e.g. $ ctr run --id foo docker.io/library/busybox:latest ls Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
parent
d43628c930
commit
71870d7631
1 changed files with 9 additions and 3 deletions
|
@ -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",
|
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||||||
}
|
}
|
||||||
env = append(env, config.Env...)
|
env = append(env, config.Env...)
|
||||||
|
cmd := config.Cmd
|
||||||
|
if v := context.Args().Tail(); len(v) > 0 {
|
||||||
|
cmd = v
|
||||||
|
}
|
||||||
var (
|
var (
|
||||||
args = append(config.Entrypoint, config.Cmd...)
|
// TODO: support overriding entrypoint
|
||||||
|
args = append(config.Entrypoint, cmd...)
|
||||||
tty = context.Bool("tty")
|
tty = context.Bool("tty")
|
||||||
uid, gid uint32
|
uid, gid uint32
|
||||||
)
|
)
|
||||||
|
@ -216,6 +221,7 @@ func spec(id string, config *ocispec.ImageConfig, context *cli.Context) (*specs.
|
||||||
var runCommand = cli.Command{
|
var runCommand = cli.Command{
|
||||||
Name: "run",
|
Name: "run",
|
||||||
Usage: "run a container",
|
Usage: "run a container",
|
||||||
|
ArgsUsage: "IMAGE [COMMAND] [ARG...]",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "id",
|
Name: "id",
|
||||||
|
|
Loading…
Reference in a new issue