DockerCLI/cli/command/image/build
Sebastiaan van Stijn c2535aa467
build: error if Dockerfile name is passed with Dockerfile from stdin
When passing a Dockerfile through stdin, it's not possible to specify the
name of the Dockerfile (using the `-f` option). When building with BuildKit
enabled, an error is already produced for this case, but the classic builder
silently ignored it.

This patch adds an error for this situation:

    echo -e 'FROM busybox' | DOCKER_BUILDKIT=0 docker build -f some.Dockerfile -
    DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
    BuildKit is currently disabled; enable it by removing the DOCKER_BUILDKIT=0
    environment-variable.

    unable to prepare context: ambiguous Dockerfile source: both stdin and flag correspond to Dockerfiles

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-13 14:03:03 +02:00
..
context.go build: error if Dockerfile name is passed with Dockerfile from stdin 2023-06-13 14:03:03 +02:00
context_test.go build: error if Dockerfile name is passed with Dockerfile from stdin 2023-06-13 14:03:03 +02:00
context_unix.go remove pre-go1.17 build-tags 2023-05-05 18:23:03 +02:00
context_windows.go gofmt with go1.17 2022-03-26 20:21:00 +01:00
dockerignore.go vendor: docker v20.10.3-0.20221006185438-87d9d96ab0b6 (v22.06-dev) 2022-10-21 15:15:11 +02:00