summaryrefslogtreecommitdiff
path: root/cmd/podman/build.go
diff options
context:
space:
mode:
authorTomSweeneyRedHat <tsweeney@redhat.com>2019-10-30 19:36:42 -0400
committerTomSweeneyRedHat <tsweeney@redhat.com>2019-11-01 09:57:56 -0400
commit677a0e5d60c45711cba56032c23783c1d010a49e (patch)
treeeb778d5c58e81cf450b3e7a92482d019241ed15a /cmd/podman/build.go
parent69165fa04d9db306809a0b110491f9a572f74431 (diff)
downloadpodman-677a0e5d60c45711cba56032c23783c1d010a49e.tar.gz
podman-677a0e5d60c45711cba56032c23783c1d010a49e.tar.bz2
podman-677a0e5d60c45711cba56032c23783c1d010a49e.zip
Validate contextdir on build
We never verified that the context directory passed into the build command was a valid directory. When we then slapped a default Containerfile name onto it, things went south fast if the user had passed us a file and not a directory. Fixes: #4383 Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
Diffstat (limited to 'cmd/podman/build.go')
-rw-r--r--cmd/podman/build.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/cmd/podman/build.go b/cmd/podman/build.go
index 896d5661a..bbc1d5b5f 100644
--- a/cmd/podman/build.go
+++ b/cmd/podman/build.go
@@ -238,6 +238,9 @@ func buildCmd(c *cliconfig.BuildValues) error {
if contextDir == "" {
return errors.Errorf("no context directory specified, and no containerfile specified")
}
+ if !fileIsDir(contextDir) {
+ return errors.Errorf("context must be a directory: %v", contextDir)
+ }
if len(containerfiles) == 0 {
if checkIfFileExists(filepath.Join(contextDir, "Containerfile")) {
containerfiles = append(containerfiles, filepath.Join(contextDir, "Containerfile"))