Browse code

Windows: Allow user in builder

Signed-off-by: John Howard <jhoward@microsoft.com>
(cherry picked from commit a3c4ab9b657018cf6fc33e70a44c790563c16043)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>

John Howard authored on 2016/11/15 07:01:16
Showing 2 changed files
... ...
@@ -6,7 +6,7 @@ import "fmt"
6 6
 // a command not supported on the platform.
7 7
 func platformSupports(command string) error {
8 8
 	switch command {
9
-	case "user", "stopsignal":
9
+	case "stopsignal":
10 10
 		return fmt.Errorf("The daemon on this platform does not support the command '%s'", command)
11 11
 	}
12 12
 	return nil
... ...
@@ -7266,3 +7266,20 @@ func (s *DockerSuite) TestBuildOpaqueDirectory(c *check.C) {
7266 7266
 	_, err := buildImage("testopaquedirectory", dockerFile, false)
7267 7267
 	c.Assert(err, checker.IsNil)
7268 7268
 }
7269
+
7270
+// Windows test for USER in dockerfile
7271
+func (s *DockerSuite) TestBuildWindowsUser(c *check.C) {
7272
+	testRequires(c, DaemonIsWindows)
7273
+	name := "testbuildwindowsuser"
7274
+	_, out, err := buildImageWithOut(name,
7275
+		`FROM `+WindowsBaseImage+`
7276
+		RUN net user user /add
7277
+		USER user
7278
+		RUN set username
7279
+		`,
7280
+		true)
7281
+	if err != nil {
7282
+		c.Fatal(err)
7283
+	}
7284
+	c.Assert(strings.ToLower(out), checker.Contains, "username=user")
7285
+}