|
@@ -9,15 +9,6 @@ import (
|
|
|
"github.com/docker/docker/errdefs"
|
|
|
)
|
|
|
|
|
|
-// GetRepository returns a repository from the registry.
|
|
|
-func GetRepository(ctx context.Context, ref reference.Named, config *ImagePullConfig) (repository distribution.Repository, lastError error) {
|
|
|
- repos, err := getRepositories(ctx, ref, config, true)
|
|
|
- if len(repos) == 0 {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
- return repos[0], nil
|
|
|
-}
|
|
|
-
|
|
|
// GetRepositories returns a list of repositories configured for the given
|
|
|
// reference. Multiple repositories can be returned if the reference is for
|
|
|
// the default (Docker Hub) registry and a mirror is configured, but it omits
|
|
@@ -26,10 +17,6 @@ func GetRepository(ctx context.Context, ref reference.Named, config *ImagePullCo
|
|
|
// It returns an error if it was unable to reach any of the registries for
|
|
|
// the given reference, or if the provided reference is invalid.
|
|
|
func GetRepositories(ctx context.Context, ref reference.Named, config *ImagePullConfig) ([]distribution.Repository, error) {
|
|
|
- return getRepositories(ctx, ref, config, false)
|
|
|
-}
|
|
|
-
|
|
|
-func getRepositories(ctx context.Context, ref reference.Named, config *ImagePullConfig, firstOnly bool) ([]distribution.Repository, error) {
|
|
|
repoInfo, err := config.RegistryService.ResolveRepository(ref)
|
|
|
if err != nil {
|
|
|
return nil, errdefs.InvalidParameter(err)
|
|
@@ -56,9 +43,6 @@ func getRepositories(ctx context.Context, ref reference.Named, config *ImagePull
|
|
|
continue
|
|
|
}
|
|
|
repositories = append(repositories, repo)
|
|
|
- if firstOnly {
|
|
|
- return repositories, nil
|
|
|
- }
|
|
|
}
|
|
|
if len(repositories) == 0 {
|
|
|
return nil, lastError
|