Merge pull request #2207 from mikedanese/default-registry-auth

added support for authentication against the default docker registry...
This commit is contained in:
Joe Beda 2014-11-06 12:39:49 -08:00
commit cc30ed14d0

View File

@ -613,6 +613,8 @@ func (dk *dockerKeyring) reindex() {
sort.Sort(sort.Reverse(sort.StringSlice(dk.index)))
}
const defaultRegistryHost = "index.docker.io/v1/"
func (dk *dockerKeyring) lookup(image string) (docker.AuthConfiguration, bool) {
// range over the index as iterating over a map does not provide
// a predictable ordering
@ -624,6 +626,11 @@ func (dk *dockerKeyring) lookup(image string) (docker.AuthConfiguration, bool) {
return dk.creds[k], true
}
// use credentials for the default registry if provided
if auth, ok := dk.creds[defaultRegistryHost]; ok {
return auth, true
}
return docker.AuthConfiguration{}, false
}