Signed-off-by: John Howard <jhoward@microsoft.com>
| ... | ... |
@@ -20,6 +20,26 @@ 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 |
+ // DefaultRegistryVersionHeader is the name of the default HTTP header |
|
| 27 |
+ // that carries Registry version info |
|
| 28 |
+ DefaultRegistryVersionHeader = "Docker-Distribution-Api-Version" |
|
| 29 |
+ // DefaultV1Registry is the URI of the default v1 registry |
|
| 30 |
+ DefaultV1Registry = "https://index.docker.io" |
|
| 31 |
+ |
|
| 32 |
+ // IndexServer is the v1 registry server used for user auth + account creation |
|
| 33 |
+ IndexServer = DefaultV1Registry + "/v1/" |
|
| 34 |
+ // IndexName is the name of the index |
|
| 35 |
+ IndexName = "docker.io" |
|
| 36 |
+ |
|
| 37 |
+ // NotaryServer is the endpoint serving the Notary trust server |
|
| 38 |
+ NotaryServer = "https://notary.docker.io" |
|
| 39 |
+ |
|
| 40 |
+ // IndexServer = "https://registry-stage.hub.docker.com/v1/" |
|
| 41 |
+) |
|
| 42 |
+ |
|
| 23 | 43 |
var ( |
| 24 | 44 |
// ErrInvalidRepositoryName is an error returned if the repository name did |
| 25 | 45 |
// not have the correct form |
| 26 | 46 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,19 @@ |
| 0 |
+// +build !windows |
|
| 1 |
+ |
|
| 2 |
+package registry |
|
| 3 |
+ |
|
| 4 |
+const ( |
|
| 5 |
+ // DefaultV2Registry is the URI of the default v2 registry |
|
| 6 |
+ DefaultV2Registry = "https://registry-1.docker.io" |
|
| 7 |
+ |
|
| 8 |
+ // CertsDir is the directory where certificates are stored |
|
| 9 |
+ CertsDir = "/etc/docker/certs.d" |
|
| 10 |
+) |
|
| 11 |
+ |
|
| 12 |
+// cleanPath is used to ensure that a directory name is valid on the target |
|
| 13 |
+// platform. It will be passed in something *similar* to a URL such as |
|
| 14 |
+// https:/index.docker.io/v1. Not all platforms support directory names |
|
| 15 |
+// which contain those characters (such as : on Windows) |
|
| 16 |
+func cleanPath(s string) string {
|
|
| 17 |
+ return s |
|
| 18 |
+} |
| 0 | 19 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,25 @@ |
| 0 |
+package registry |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "os" |
|
| 4 |
+ "path/filepath" |
|
| 5 |
+ "strings" |
|
| 6 |
+) |
|
| 7 |
+ |
|
| 8 |
+// DefaultV2Registry is the URI of the default (official) v2 registry. |
|
| 9 |
+// This is the windows-specific endpoint. |
|
| 10 |
+// |
|
| 11 |
+// Currently it is a TEMPORARY link that allows Microsoft to continue |
|
| 12 |
+// development of Docker Engine for Windows. |
|
| 13 |
+const DefaultV2Registry = "https://ms-tp3.registry-1.docker.io" |
|
| 14 |
+ |
|
| 15 |
+// CertsDir is the directory where certificates are stored |
|
| 16 |
+var CertsDir = os.Getenv("programdata") + `\docker\certs.d`
|
|
| 17 |
+ |
|
| 18 |
+// cleanPath is used to ensure that a directory name is valid on the target |
|
| 19 |
+// platform. It will be passed in something *similar* to a URL such as |
|
| 20 |
+// https:\index.docker.io\v1. Not all platforms support directory names |
|
| 21 |
+// which contain those characters (such as : on Windows) |
|
| 22 |
+func cleanPath(s string) string {
|
|
| 23 |
+ return filepath.FromSlash(strings.Replace(s, ":", "", -1)) |
|
| 24 |
+} |
| 0 | 25 |
deleted file mode 100644 |
| ... | ... |
@@ -1,24 +0,0 @@ |
| 1 |
-package registry |
|
| 2 |
- |
|
| 3 |
-const ( |
|
| 4 |
- // DefaultNamespace is the default namespace |
|
| 5 |
- DefaultNamespace = "docker.io" |
|
| 6 |
- // DefaultRegistryVersionHeader is the name of the default HTTP header |
|
| 7 |
- // that carries Registry version info |
|
| 8 |
- DefaultRegistryVersionHeader = "Docker-Distribution-Api-Version" |
|
| 9 |
- // DefaultV1Registry is the URI of the default v1 registry |
|
| 10 |
- DefaultV1Registry = "https://index.docker.io" |
|
| 11 |
- |
|
| 12 |
- // CertsDir is the directory where certificates are stored |
|
| 13 |
- CertsDir = "/etc/docker/certs.d" |
|
| 14 |
- |
|
| 15 |
- // IndexServer is the v1 registry server used for user auth + account creation |
|
| 16 |
- IndexServer = DefaultV1Registry + "/v1/" |
|
| 17 |
- // IndexName is the name of the index |
|
| 18 |
- IndexName = "docker.io" |
|
| 19 |
- |
|
| 20 |
- // NotaryServer is the endpoint serving the Notary trust server |
|
| 21 |
- NotaryServer = "https://notary.docker.io" |
|
| 22 |
- |
|
| 23 |
- // IndexServer = "https://registry-stage.hub.docker.com/v1/" |
|
| 24 |
-) |
| 7 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,10 +0,0 @@ |
| 1 |
-// +build windows |
|
| 2 |
- |
|
| 3 |
-package registry |
|
| 4 |
- |
|
| 5 |
-// DefaultV2Registry is the URI of the default (official) v2 registry. |
|
| 6 |
-// This is the windows-specific endpoint. |
|
| 7 |
-// |
|
| 8 |
-// Currently it is a TEMPORARY link that allows Microsoft to continue |
|
| 9 |
-// development of Docker Engine for Windows. |
|
| 10 |
-const DefaultV2Registry = "https://ms-tp3.registry-1.docker.io" |
| ... | ... |
@@ -58,7 +58,7 @@ func newTLSConfig(hostname string, isSecure bool) (*tls.Config, error) {
|
| 58 | 58 |
tlsConfig.InsecureSkipVerify = !isSecure |
| 59 | 59 |
|
| 60 | 60 |
if isSecure {
|
| 61 |
- hostDir := filepath.Join(CertsDir, hostname) |
|
| 61 |
+ hostDir := filepath.Join(CertsDir, cleanPath(hostname)) |
|
| 62 | 62 |
logrus.Debugf("hostDir: %s", hostDir)
|
| 63 | 63 |
if err := ReadCertsDirectory(&tlsConfig, hostDir); err != nil {
|
| 64 | 64 |
return nil, err |