mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
'docker run' with no argument no longer hardcodes a default image and command
This commit is contained in:
parent
841c7ac0f9
commit
829eeb07f8
1 changed files with 5 additions and 17 deletions
22
commands.go
22
commands.go
|
@ -806,24 +806,12 @@ func (srv *Server) CmdRun(stdin io.ReadCloser, stdout io.Writer, args ...string)
|
|||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if cmd.NArg() < 2 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
name := cmd.Arg(0)
|
||||
var cmdline []string
|
||||
|
||||
if len(cmd.Args()) >= 2 {
|
||||
cmdline = cmd.Args()[1:]
|
||||
}
|
||||
// Choose a default image if needed
|
||||
if name == "" {
|
||||
name = "base"
|
||||
}
|
||||
|
||||
// Choose a default command if needed
|
||||
if len(cmdline) == 0 {
|
||||
*fl_stdin = true
|
||||
*fl_tty = true
|
||||
cmdline = []string{"/bin/bash", "-i"}
|
||||
}
|
||||
|
||||
cmdline := cmd.Args()[1:]
|
||||
// Create new container
|
||||
container, err := srv.runtime.Create(cmdline[0], cmdline[1:], name,
|
||||
&Config{
|
||||
|
|
Loading…
Reference in a new issue