diff --git a/src/pkg/reg/adapter/dockerhub/adapter.go b/src/pkg/reg/adapter/dockerhub/adapter.go index 821bc4808b2..fe99b577a46 100644 --- a/src/pkg/reg/adapter/dockerhub/adapter.go +++ b/src/pkg/reg/adapter/dockerhub/adapter.go @@ -46,6 +46,13 @@ func newAdapter(registry *model.Registry) (adp.Adapter, error) { return nil, err } + var registryURL string + if registry.URL != baseURL { + registryURL = registry.URL + } else { + registryURL = defaultRegistryURL + } + return &adapter{ client: client, registry: registry, diff --git a/src/pkg/reg/adapter/dockerhub/consts.go b/src/pkg/reg/adapter/dockerhub/consts.go index 6b466805401..d7af5f50dbd 100644 --- a/src/pkg/reg/adapter/dockerhub/consts.go +++ b/src/pkg/reg/adapter/dockerhub/consts.go @@ -18,7 +18,7 @@ import "fmt" const ( baseURL = "https://hub.docker.com" - registryURL = "https://registry-1.docker.io" + defaultRegistryURL = "https://registry-1.docker.io" loginPath = "/v2/users/login/" listNamespacePath = "/v2/repositories/namespaces" createNamespacePath = "/v2/orgs/"