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

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

cmd.
This commit is contained in:
Marco Hennings 2013-08-23 14:02:24 +02:00
parent da3bb9a7c6
commit ad322d7cca

View file

@ -1432,6 +1432,25 @@ func (cli *DockerCli) CmdRun(args ...string) error {
repos, tag := utils.ParseRepositoryTag(config.Image) repos, tag := utils.ParseRepositoryTag(config.Image)
v.Set("fromImage", repos) v.Set("fromImage", repos)
v.Set("tag", tag) 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) err = cli.stream("POST", "/images/create?"+v.Encode(), nil, cli.err)
if err != nil { if err != nil {
return err return err