mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fixed issue #158 (docker crashes when docker run is called with not enough arguments)
This commit is contained in:
parent
a61e68275a
commit
c8ca50b483
1 changed files with 11 additions and 2 deletions
13
container.go
13
container.go
|
@ -76,6 +76,15 @@ func ParseRun(args []string) (*Config, error) {
|
|||
if err := cmd.Parse(args); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
parsedArgs := cmd.Args()
|
||||
runCmd := []string{}
|
||||
image := ""
|
||||
if len(parsedArgs) >= 1 {
|
||||
image = cmd.Arg(0)
|
||||
}
|
||||
if len(parsedArgs) > 1 {
|
||||
runCmd = parsedArgs[1:]
|
||||
}
|
||||
config := &Config{
|
||||
Ports: fl_ports,
|
||||
User: *fl_user,
|
||||
|
@ -84,8 +93,8 @@ func ParseRun(args []string) (*Config, error) {
|
|||
Memory: *fl_memory,
|
||||
Detach: *fl_detach,
|
||||
Env: fl_env,
|
||||
Cmd: cmd.Args()[1:],
|
||||
Image: cmd.Arg(0),
|
||||
Cmd: runCmd,
|
||||
Image: image,
|
||||
}
|
||||
return config, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue