From 829eeb07f8ecd9d53c667a6fdfe513f5a7df54ac Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Fri, 22 Mar 2013 20:55:17 -0700 Subject: [PATCH] 'docker run' with no argument no longer hardcodes a default image and command --- commands.go | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/commands.go b/commands.go index 67a782f595..aa60ca3346 100644 --- a/commands.go +++ b/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{