1
0
Fork 0
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:
shin- 2013-03-25 07:17:11 -07:00
parent a61e68275a
commit c8ca50b483

View file

@ -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
}