Fix builder when num of RUN args is 1

FROM scratch
ADD echo /
RUN [ "echo" ]

will die with
  exec: "/bin/sh": stat /bin/sh: no such file or directory

Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
Doug Davis
2015-03-11 07:30:44 -07:00
parent 13bfbfc84b
commit 645f8a32df
4 changed files with 32 additions and 3 deletions
+27
View File
@@ -5227,3 +5227,30 @@ func TestBuildNotVerbose(t *testing.T) {
logDone("build - not verbose")
}
func TestBuildRUNoneJSON(t *testing.T) {
name := "testbuildrunonejson"
defer deleteAllContainers()
defer deleteImages(name)
ctx, err := fakeContext(`FROM hello-world:latest
RUN [ "/hello" ]`, map[string]string{})
if err != nil {
t.Fatal(err)
}
defer ctx.Close()
buildCmd := exec.Command(dockerBinary, "build", "--no-cache", "-t", name, ".")
buildCmd.Dir = ctx.Dir
out, _, err := runCommandWithOutput(buildCmd)
if err != nil {
t.Fatalf("failed to build the image: %s, %v", out, err)
}
if !strings.Contains(out, "Hello from Docker") {
t.Fatalf("bad output: %s", out)
}
logDone("build - RUN with one JSON arg")
}