Signed-off-by: Tibor Vass <tibor@docker.com>
| ... | ... |
@@ -20,28 +20,6 @@ type Options struct {
|
| 20 | 20 |
InsecureRegistries opts.ListOpts |
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 |
-const ( |
|
| 24 |
- // DefaultNamespace is the default namespace |
|
| 25 |
- DefaultNamespace = "docker.io" |
|
| 26 |
- // DefaultV2Registry is the URI of the default v2 registry |
|
| 27 |
- DefaultV2Registry = "https://registry-1.docker.io" |
|
| 28 |
- // DefaultRegistryVersionHeader is the name of the default HTTP header |
|
| 29 |
- // that carries Registry version info |
|
| 30 |
- DefaultRegistryVersionHeader = "Docker-Distribution-Api-Version" |
|
| 31 |
- // DefaultV1Registry is the URI of the default v1 registry |
|
| 32 |
- DefaultV1Registry = "https://index.docker.io" |
|
| 33 |
- |
|
| 34 |
- // CertsDir is the directory where certificates are stored |
|
| 35 |
- CertsDir = "/etc/docker/certs.d" |
|
| 36 |
- |
|
| 37 |
- // IndexServer is the v1 registry server used for user auth + account creation |
|
| 38 |
- IndexServer = DefaultV1Registry + "/v1/" |
|
| 39 |
- // IndexName is the name of the index |
|
| 40 |
- IndexName = "docker.io" |
|
| 41 |
- // NotaryServer is the endpoint serving the Notary trust server |
|
| 42 |
- NotaryServer = "https://notary.docker.io" |
|
| 43 |
-) |
|
| 44 |
- |
|
| 45 | 23 |
var ( |
| 46 | 24 |
// ErrInvalidRepositoryName is an error returned if the repository name did |
| 47 | 25 |
// not have the correct form |
| 48 | 26 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,24 @@ |
| 0 |
+package registry |
|
| 1 |
+ |
|
| 2 |
+const ( |
|
| 3 |
+ // DefaultNamespace is the default namespace |
|
| 4 |
+ DefaultNamespace = "docker.io" |
|
| 5 |
+ // DefaultRegistryVersionHeader is the name of the default HTTP header |
|
| 6 |
+ // that carries Registry version info |
|
| 7 |
+ DefaultRegistryVersionHeader = "Docker-Distribution-Api-Version" |
|
| 8 |
+ // DefaultV1Registry is the URI of the default v1 registry |
|
| 9 |
+ DefaultV1Registry = "https://index.docker.io" |
|
| 10 |
+ |
|
| 11 |
+ // CertsDir is the directory where certificates are stored |
|
| 12 |
+ CertsDir = "/etc/docker/certs.d" |
|
| 13 |
+ |
|
| 14 |
+ // IndexServer is the v1 registry server used for user auth + account creation |
|
| 15 |
+ IndexServer = DefaultV1Registry + "/v1/" |
|
| 16 |
+ // IndexName is the name of the index |
|
| 17 |
+ IndexName = "docker.io" |
|
| 18 |
+ |
|
| 19 |
+ // NotaryServer is the endpoint serving the Notary trust server |
|
| 20 |
+ NotaryServer = "https://notary.docker.io" |
|
| 21 |
+ |
|
| 22 |
+ // IndexServer = "https://registry-stage.hub.docker.com/v1/" |
|
| 23 |
+) |
| 0 | 6 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,10 @@ |
| 0 |
+// +build windows |
|
| 1 |
+ |
|
| 2 |
+package registry |
|
| 3 |
+ |
|
| 4 |
+// DefaultV2Registry is the URI of the default (official) v2 registry. |
|
| 5 |
+// This is the windows-specific endpoint. |
|
| 6 |
+// |
|
| 7 |
+// Currently it is a TEMPORARY link that allows Microsoft to continue |
|
| 8 |
+// development of Docker Engine for Windows. |
|
| 9 |
+const DefaultV2Registry = "https://ms-tp3.registry-1.docker.io" |
| ... | ... |
@@ -5,6 +5,7 @@ import ( |
| 5 | 5 |
"fmt" |
| 6 | 6 |
"net/http" |
| 7 | 7 |
"net/url" |
| 8 |
+ "runtime" |
|
| 8 | 9 |
"strings" |
| 9 | 10 |
|
| 10 | 11 |
"github.com/docker/distribution/registry/client/auth" |
| ... | ... |
@@ -138,14 +139,16 @@ func (s *Service) LookupEndpoints(repoName string) (endpoints []APIEndpoint, err |
| 138 | 138 |
TrimHostname: true, |
| 139 | 139 |
TLSConfig: tlsConfig, |
| 140 | 140 |
}) |
| 141 |
- // v1 registry |
|
| 142 |
- endpoints = append(endpoints, APIEndpoint{
|
|
| 143 |
- URL: DefaultV1Registry, |
|
| 144 |
- Version: APIVersion1, |
|
| 145 |
- Official: true, |
|
| 146 |
- TrimHostname: true, |
|
| 147 |
- TLSConfig: tlsConfig, |
|
| 148 |
- }) |
|
| 141 |
+ if runtime.GOOS == "linux" { // do not inherit legacy API for OSes supported in the future
|
|
| 142 |
+ // v1 registry |
|
| 143 |
+ endpoints = append(endpoints, APIEndpoint{
|
|
| 144 |
+ URL: DefaultV1Registry, |
|
| 145 |
+ Version: APIVersion1, |
|
| 146 |
+ Official: true, |
|
| 147 |
+ TrimHostname: true, |
|
| 148 |
+ TLSConfig: tlsConfig, |
|
| 149 |
+ }) |
|
| 150 |
+ } |
|
| 149 | 151 |
return endpoints, nil |
| 150 | 152 |
} |
| 151 | 153 |
|