Windows: Allow user in builder

Signed-off-by: John Howard <jhoward@microsoft.com>
(cherry picked from commit a3c4ab9b65)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
John Howard 2016-11-14 14:01:16 -08:00 committed by Victor Vieux
parent 902774c871
commit 530b7cb4a0
2 changed files with 18 additions and 1 deletions

View file

@ -6,7 +6,7 @@ import "fmt"
// a command not supported on the platform.
func platformSupports(command string) error {
switch command {
case "user", "stopsignal":
case "stopsignal":
return fmt.Errorf("The daemon on this platform does not support the command '%s'", command)
}
return nil

View file

@ -7266,3 +7266,20 @@ func (s *DockerSuite) TestBuildOpaqueDirectory(c *check.C) {
_, err := buildImage("testopaquedirectory", dockerFile, false)
c.Assert(err, checker.IsNil)
}
// Windows test for USER in dockerfile
func (s *DockerSuite) TestBuildWindowsUser(c *check.C) {
testRequires(c, DaemonIsWindows)
name := "testbuildwindowsuser"
_, out, err := buildImageWithOut(name,
`FROM `+WindowsBaseImage+`
RUN net user user /add
USER user
RUN set username
`,
true)
if err != nil {
c.Fatal(err)
}
c.Assert(strings.ToLower(out), checker.Contains, "username=user")
}