Browse code

Merge pull request #8179 from erikh/parser_fix_cmd_null

Parser fix cmd null

Tibor Vass authored on 2014/09/24 02:42:55
Showing 2 changed files
... ...
@@ -150,7 +150,7 @@ func (b *Builder) Run(context io.Reader) (string, error) {
150 150
 	b.dockerfile = ast
151 151
 
152 152
 	// some initializations that would not have been supplied by the caller.
153
-	b.Config = &runconfig.Config{Entrypoint: []string{}, Cmd: []string{"/bin/sh", "-c"}}
153
+	b.Config = &runconfig.Config{Entrypoint: []string{}, Cmd: nil}
154 154
 	b.TmpContainers = map[string]struct{}{}
155 155
 
156 156
 	for i, n := range b.dockerfile.Children {
... ...
@@ -2126,3 +2126,19 @@ func TestBuildClearCmd(t *testing.T) {
2126 2126
 	}
2127 2127
 	logDone("build - clearcmd")
2128 2128
 }
2129
+
2130
+func TestBuildEmptyCmd(t *testing.T) {
2131
+	name := "testbuildemptycmd"
2132
+	defer deleteImages(name)
2133
+	if _, err := buildImage(name, "FROM scratch\nMAINTAINER quux\n", true); err != nil {
2134
+		t.Fatal(err)
2135
+	}
2136
+	res, err := inspectFieldJSON(name, "Config.Cmd")
2137
+	if err != nil {
2138
+		t.Fatal(err)
2139
+	}
2140
+	if res != "null" {
2141
+		t.Fatalf("Cmd %s, expected %s", res, "null")
2142
+	}
2143
+	logDone("build - empty cmd")
2144
+}