build: error out if buildkit is on and stdin is used for both dockerfile and context

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass 2018-05-22 23:23:15 +00:00
parent 5314a8fc06
commit 89e102474c
2 changed files with 6 additions and 1 deletions

View File

@ -35,6 +35,8 @@ import (
"github.com/spf13/cobra"
)
var errStdinConflict = errors.New("invalid argument: can't use stdin for both build context and dockerfile")
type buildOptions struct {
context string
dockerfileName string
@ -192,7 +194,7 @@ func runBuild(dockerCli command.Cli, options buildOptions) error {
if options.dockerfileFromStdin() {
if options.contextFromStdin() {
return errors.New("invalid argument: can't use stdin for both build context and dockerfile")
return errStdinConflict
}
dockerfileCtx = dockerCli.In()
}

View File

@ -51,6 +51,9 @@ func runBuildBuildKit(dockerCli command.Cli, options buildOptions) error {
)
switch {
case options.contextFromStdin():
if options.dockerfileFromStdin() {
return errStdinConflict
}
rc, isArchive, err := build.DetectArchiveReader(os.Stdin)
if err != nil {
return err