1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #20278 from aaronlehmann/build-authconfig

Pass authentication credentials through to build
This commit is contained in:
Jess Frazelle 2016-02-12 18:37:49 -05:00
commit 64a4605892
2 changed files with 25 additions and 0 deletions

View file

@ -159,6 +159,8 @@ func (br *buildRouter) postBuild(ctx context.Context, w http.ResponseWriter, r *
buildOptions.Dockerfile = dockerfileName
}
buildOptions.AuthConfigs = authConfigs
out = output
if buildOptions.SuppressOutput {
out = notVerboseBuffer

View file

@ -6534,3 +6534,26 @@ func (s *DockerSuite) TestBuildWorkdirWindowsPath(c *check.C) {
c.Fatal(err)
}
}
func (s *DockerRegistryAuthSuite) TestBuildFromAuthenticatedRegistry(c *check.C) {
dockerCmd(c, "login", "-u", s.reg.username, "-p", s.reg.password, "-e", s.reg.email, privateRegistryURL)
baseImage := privateRegistryURL + "/baseimage"
_, err := buildImage(baseImage, `
FROM busybox
ENV env1 val1
`, true)
c.Assert(err, checker.IsNil)
dockerCmd(c, "push", baseImage)
dockerCmd(c, "rmi", baseImage)
_, err = buildImage(baseImage, fmt.Sprintf(`
FROM %s
ENV env2 val2
`, baseImage), true)
c.Assert(err, checker.IsNil)
}