Browse Source

Merge pull request #2984 from SvenDowideit/2319-build-check-for-dockerfile

check on the client side that there is a Dockerfile
Guillaume J. Charmes 11 years ago
parent
commit
5f2313aad3
1 changed files with 4 additions and 0 deletions
  1. 4 0
      commands.go

+ 4 - 0
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