Windows: Allow user in builder

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2016-11-14 14:01:16 -08:00
parent 65835bfaa6
commit a3c4ab9b65
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

@ -7287,3 +7287,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")
}