1
0
mirror of https://github.com/docker/cli.git synced 2026-01-25 03:42:05 +03:00

Send corrent endpoint authentication when an image is pulled during the run

cmd.
Upstream-commit: ad322d7cca4857292d41e164058382f83a06cf98
Component: engine
This commit is contained in:
Marco Hennings
2013-08-23 14:02:24 +02:00
parent 9762bbddd8
commit 42b37ac06c

View File

@@ -1432,6 +1432,25 @@ func (cli *DockerCli) CmdRun(args ...string) error {
repos, tag := utils.ParseRepositoryTag(config.Image)
v.Set("fromImage", repos)
v.Set("tag", tag)
// Resolve the Repository name from fqn to endpoint + name
var endpoint string
endpoint, _, err = registry.ResolveRepositoryName(repos)
if err != nil {
return err
}
// Load the auth config file, to be able to pull the image
cli.LoadConfigFile()
// Resolve the Auth config relevant for this server
authConfig := cli.configFile.ResolveAuthConfig(endpoint)
buf, err := json.Marshal(authConfig)
if err != nil {
return err
}
v.Set("authConfig", base64.URLEncoding.EncodeToString(buf))
err = cli.stream("POST", "/images/create?"+v.Encode(), nil, cli.err)
if err != nil {
return err