Pass authentication credentials through to build
In Docker 1.10 and earlier, "docker build" can do a build FROM a private repository that hasn't yet been pulled. This doesn't work on master. I bisected this to https://github.com/docker/docker/pull/19414. AuthConfigs is deserialized from the HTTP request, but not included in the builder options. Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com> Upstream-commit: 6fed46aeb97943315aed12f2dc62565f7bcc53dc Component: engine
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user