From d605e82badf64c3033f5f26199285aed414f63dd Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Fri, 30 Aug 2013 18:08:29 +0000 Subject: [PATCH] fix error in docker build when param is not a directory --- commands.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/commands.go b/commands.go index 6d78c032f3..0b276ff77f 100644 --- a/commands.go +++ b/commands.go @@ -187,8 +187,10 @@ func (cli *DockerCli) CmdBuild(args ...string) error { } else if utils.IsURL(cmd.Arg(0)) || utils.IsGIT(cmd.Arg(0)) { isRemote = true } else { - if _, err := os.Stat(cmd.Arg(0)); err != nil { + if fi, err := os.Stat(cmd.Arg(0)); err != nil { return err + } else if !fi.IsDir() { + return fmt.Errorf("\"%s\" is not a path or URL. Please provide a path to a directory containing a Dockerfile.", cmd.Arg(0)) } context, err = Tar(cmd.Arg(0), Uncompressed) }