From 26cf8b9aff1cffa7c3e3ae7e720c960ff545ee78 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Mon, 2 Dec 2013 15:52:45 +1000 Subject: [PATCH] check on the client side that there is a Dockerfile, so we don't upload a huge stack of files, only to realise we can't do anything --- commands.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/commands.go b/commands.go index 5d2ea1806c..fb4b11cfc1 100644 --- a/commands.go +++ b/commands.go @@ -195,6 +195,10 @@ func (cli *DockerCli) CmdBuild(args ...string) error { if _, err := os.Stat(cmd.Arg(0)); err != nil { return err } + filename := path.Join(cmd.Arg(0), "Dockerfile") + if _, err = os.Stat(filename); os.IsNotExist(err) { + return fmt.Errorf("no Dockerfile found in %s", cmd.Arg(0)) + } context, err = archive.Tar(cmd.Arg(0), archive.Uncompressed) } var body io.Reader