Skip to content

Commit

Permalink
Merge pull request moby#14970 from tiborvass/windows-registry-endpoint
Browse files Browse the repository at this point in the history
registry: Change default endpoint on windows to a windows-specific one
  • Loading branch information
tiborvass committed Jul 31, 2015
2 parents 9a9a12b + 4a92b8a commit ad96fc3
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 30 deletions.
22 changes: 0 additions & 22 deletions registry/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,6 @@ type Options struct {
InsecureRegistries opts.ListOpts
}

const (
// DefaultNamespace is the default namespace
DefaultNamespace = "docker.io"
// DefaultV2Registry is the URI of the default v2 registry
DefaultV2Registry = "https://registry-1.docker.io"
// DefaultRegistryVersionHeader is the name of the default HTTP header
// that carries Registry version info
DefaultRegistryVersionHeader = "Docker-Distribution-Api-Version"
// DefaultV1Registry is the URI of the default v1 registry
DefaultV1Registry = "https://index.docker.io"

// CertsDir is the directory where certificates are stored
CertsDir = "/etc/docker/certs.d"

// IndexServer is the v1 registry server used for user auth + account creation
IndexServer = DefaultV1Registry + "/v1/"
// IndexName is the name of the index
IndexName = "docker.io"
// NotaryServer is the endpoint serving the Notary trust server
NotaryServer = "https://notary.docker.io"
)

var (
// ErrInvalidRepositoryName is an error returned if the repository name did
// not have the correct form
Expand Down
24 changes: 24 additions & 0 deletions registry/consts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package registry

const (
// DefaultNamespace is the default namespace
DefaultNamespace = "docker.io"
// DefaultRegistryVersionHeader is the name of the default HTTP header
// that carries Registry version info
DefaultRegistryVersionHeader = "Docker-Distribution-Api-Version"
// DefaultV1Registry is the URI of the default v1 registry
DefaultV1Registry = "https://index.docker.io"

// CertsDir is the directory where certificates are stored
CertsDir = "/etc/docker/certs.d"

// IndexServer is the v1 registry server used for user auth + account creation
IndexServer = DefaultV1Registry + "/v1/"
// IndexName is the name of the index
IndexName = "docker.io"

// NotaryServer is the endpoint serving the Notary trust server
NotaryServer = "https://notary.docker.io"

// IndexServer = "https://registry-stage.hub.docker.com/v1/"
)
6 changes: 6 additions & 0 deletions registry/consts_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// +build !windows

package registry

// DefaultV2Registry is the URI of the default v2 registry
const DefaultV2Registry = "https://registry-1.docker.io"
10 changes: 10 additions & 0 deletions registry/consts_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// +build windows

package registry

// DefaultV2Registry is the URI of the default (official) v2 registry.
// This is the windows-specific endpoint.
//
// Currently it is a TEMPORARY link that allows Microsoft to continue
// development of Docker Engine for Windows.
const DefaultV2Registry = "https://ms-tp3.registry-1.docker.io"
1 change: 1 addition & 0 deletions registry/registry.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package registry contains client primitives to interact with a remote Docker registry.
package registry

import (
Expand Down
19 changes: 11 additions & 8 deletions registry/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"net/url"
"runtime"
"strings"

"github.com/docker/distribution/registry/client/auth"
Expand Down Expand Up @@ -138,14 +139,16 @@ func (s *Service) LookupEndpoints(repoName string) (endpoints []APIEndpoint, err
TrimHostname: true,
TLSConfig: tlsConfig,
})
// v1 registry
endpoints = append(endpoints, APIEndpoint{
URL: DefaultV1Registry,
Version: APIVersion1,
Official: true,
TrimHostname: true,
TLSConfig: tlsConfig,
})
if runtime.GOOS == "linux" { // do not inherit legacy API for OSes supported in the future
// v1 registry
endpoints = append(endpoints, APIEndpoint{
URL: DefaultV1Registry,
Version: APIVersion1,
Official: true,
TrimHostname: true,
TLSConfig: tlsConfig,
})
}
return endpoints, nil
}

Expand Down

0 comments on commit ad96fc3

Please sign in to comment.