diff options
author | Richard Scothern <richard.scothern@gmail.com> | 2015-09-16 10:42:17 -0700 |
---|---|---|
committer | Richard Scothern <richard.scothern@gmail.com> | 2015-09-25 15:59:42 -0700 |
commit | 39f2f15a35121f348e1a87db4203bcb72e632b16 (patch) | |
tree | 29863a31f2319f87f01fa04280889fb633afa372 /registry/registry.go | |
parent | 02eed8d666e1eff4b60e259189f1cdf0c6944e5d (diff) | |
download | docker-39f2f15a35121f348e1a87db4203bcb72e632b16.tar.gz |
Prevent push and pull to v1 registries by filtering the available endpoints.
Add a daemon flag to control this behaviour. Add a warning message when pulling
an image from a v1 registry. The default order of pull is slightly altered
with this changset.
Previously it was:
https v2, https v1, http v2, http v1
now it is:
https v2, http v2, https v1, http v1
Prevent login to v1 registries by explicitly setting the version before ping to
prevent fallback to v1.
Add unit tests for v2 only mode. Create a mock server that can register
handlers for various endpoints. Assert no v1 endpoints are hit with legacy
registries disabled for the following commands: pull, push, build, run and
login. Assert the opposite when legacy registries are not disabled.
Signed-off-by: Richard Scothern <richard.scothern@gmail.com>
Diffstat (limited to 'registry/registry.go')
-rw-r--r-- | registry/registry.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/registry/registry.go b/registry/registry.go index 408bc8e1fd..389bd959df 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -49,6 +49,10 @@ func init() { httpVersion = append(httpVersion, useragent.VersionInfo{"arch", runtime.GOARCH}) dockerUserAgent = useragent.AppendVersions("", httpVersion...) + + if runtime.GOOS != "linux" { + V2Only = true + } } func newTLSConfig(hostname string, isSecure bool) (*tls.Config, error) { |