code: func FnImageBuild(client *docker.Client, opts *BuildOptions) (Name string, Stdout *bytes.Buffer, err error) {
  	if opts.Dockerfile == "" {
  		opts.Dockerfile = "Dockerfile"
  	}
  	if opts.ContextDir == "" && opts.RemoteURI == "" {
  		opts.ContextDir = "./"
  	}
  	err = auth(client, opts)
  	if err != nil {
  		return
  	}
  	stdout := new(bytes.Buffer)
  	Name = opts.GetImageName()
  	if opts.ForcePull {
  		err = FnPull(client, opts)
  		return
  	}
  	err = client.BuildImage(docker.BuildImageOptions{
  		Name:           Name,
  		Dockerfile:     opts.Dockerfile,
  		SuppressOutput: true,
  		OutputStream:   stdout,
  		ContextDir:     opts.ContextDir,
  		Remote:         opts.RemoteURI,
  		Auth:           opts.Auth,
  	})
  	if err != nil {
  		if !strings.Contains(err.Error(), "Cannot locate specified Dockerfile:") { // the error is not exported so we need to verify using the message
  			return
  		}
  		err = FnPull(client, opts)
  		if err != nil {
  			return
  		}
  	}
  	Stdout = stdout
  	return
  }
docs: // FnImageBuild builds an image