fix when --config provided, don't need Image/RootFS

Signed-off-by: Lifubang <lifubang@aliyun.com>
This commit is contained in:
Lifubang
2018-08-27 11:18:25 +08:00
parent 830363acac
commit 1d9b96988f
3 changed files with 43 additions and 12 deletions

View File

@@ -110,15 +110,26 @@ var Command = cli.Command{
Action: func(context *cli.Context) error {
var (
err error
id string
ref string
id = context.Args().Get(1)
ref = context.Args().First()
tty = context.Bool("tty")
detach = context.Bool("detach")
config = context.IsSet("config")
)
if ref == "" {
return errors.New("image ref must be provided")
if config {
id = context.Args().First()
if context.NArg() > 1 {
return errors.New("with spec config file, only container id should be provided")
}
} else {
id = context.Args().Get(1)
ref = context.Args().First()
if ref == "" {
return errors.New("image ref must be provided")
}
}
if id == "" {
return errors.New("container id must be provided")