Skip to content

Commit

Permalink
Merge pull request moby#28415 from Microsoft/jjh/builduser
Browse files Browse the repository at this point in the history
Windows: Allow `USER` in builder
  • Loading branch information
LK4D4 authored Nov 17, 2016
2 parents c2fbf08 + a3c4ab9 commit 0a5a41a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion builder/dockerfile/evaluator_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions integration-cli/docker_cli_build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

0 comments on commit 0a5a41a

Please sign in to comment.