Disable legacy (v1) registries by default
| ... | ... |
@@ -406,8 +406,12 @@ func loadDaemonCliConfig(opts *daemonOptions) (*config.Config, error) {
|
| 406 | 406 |
return nil, err |
| 407 | 407 |
} |
| 408 | 408 |
|
| 409 |
+ if conf.V2Only == false {
|
|
| 410 |
+ logrus.Warnf(`The "disable-legacy-registry" option is deprecated and wil be removed in Docker v17.12. Interacting with legacy (v1) registries will no longer be supported in Docker v17.12"`) |
|
| 411 |
+ } |
|
| 412 |
+ |
|
| 409 | 413 |
if flags.Changed("graph") {
|
| 410 |
- logrus.Warnf(`the "-g / --graph" flag is deprecated. Please use "--data-root" instead`) |
|
| 414 |
+ logrus.Warnf(`The "-g / --graph" flag is deprecated. Please use "--data-root" instead`) |
|
| 411 | 415 |
} |
| 412 | 416 |
|
| 413 | 417 |
// Labels of the docker engine used to allow multiple values associated with the same key. |
| ... | ... |
@@ -102,7 +102,7 @@ func TestLoadDaemonConfigWithTrueDefaultValuesLeaveDefaults(t *testing.T) {
|
| 102 | 102 |
} |
| 103 | 103 |
|
| 104 | 104 |
func TestLoadDaemonConfigWithLegacyRegistryOptions(t *testing.T) {
|
| 105 |
- content := `{"disable-legacy-registry": true}`
|
|
| 105 |
+ content := `{"disable-legacy-registry": false}`
|
|
| 106 | 106 |
tempFile := tempfile.NewTempFile(t, "config", content) |
| 107 | 107 |
defer tempFile.Remove() |
| 108 | 108 |
|
| ... | ... |
@@ -110,5 +110,5 @@ func TestLoadDaemonConfigWithLegacyRegistryOptions(t *testing.T) {
|
| 110 | 110 |
loadedConfig, err := loadDaemonCliConfig(opts) |
| 111 | 111 |
require.NoError(t, err) |
| 112 | 112 |
require.NotNil(t, loadedConfig) |
| 113 |
- assert.True(t, loadedConfig.V2Only) |
|
| 113 |
+ assert.False(t, loadedConfig.V2Only) |
|
| 114 | 114 |
} |
| ... | ... |
@@ -2620,7 +2620,7 @@ __docker_subcommand() {
|
| 2620 | 2620 |
"($help)--default-gateway-v6[Container default gateway IPv6 address]:IPv6 address: " \ |
| 2621 | 2621 |
"($help)--default-shm-size=[Default shm size for containers]:size:" \ |
| 2622 | 2622 |
"($help)*--default-ulimit=[Default ulimits for containers]:ulimit: " \ |
| 2623 |
- "($help)--disable-legacy-registry[Disable contacting legacy registries]" \ |
|
| 2623 |
+ "($help)--disable-legacy-registry[Disable contacting legacy registries (default true)]" \ |
|
| 2624 | 2624 |
"($help)*--dns=[DNS server to use]:DNS: " \ |
| 2625 | 2625 |
"($help)*--dns-opt=[DNS options to use]:DNS option: " \ |
| 2626 | 2626 |
"($help)*--dns-search=[DNS search domains to use]:DNS search: " \ |
| ... | ... |
@@ -292,7 +292,7 @@ of the `--changes` flag that allows to pass `Dockerfile` commands. |
| 292 | 292 |
|
| 293 | 293 |
**Target For Removal In Release: v17.12** |
| 294 | 294 |
|
| 295 |
-Version 1.9 adds a flag (`--disable-legacy-registry=false`) which prevents the |
|
| 295 |
+Version 1.8.3 added a flag (`--disable-legacy-registry=false`) which prevents the |
|
| 296 | 296 |
docker daemon from `pull`, `push`, and `login` operations against v1 |
| 297 | 297 |
registries. Though enabled by default, this signals the intent to deprecate |
| 298 | 298 |
the v1 protocol. |
| ... | ... |
@@ -42,7 +42,7 @@ Options: |
| 42 | 42 |
--default-gateway-v6 ip Container default gateway IPv6 address |
| 43 | 43 |
--default-runtime string Default OCI runtime for containers (default "runc") |
| 44 | 44 |
--default-ulimit ulimit Default ulimits for containers (default []) |
| 45 |
- --disable-legacy-registry Disable contacting legacy registries |
|
| 45 |
+ --disable-legacy-registry Disable contacting legacy registries (default true) |
|
| 46 | 46 |
--dns list DNS server to use (default []) |
| 47 | 47 |
--dns-opt list DNS options to use (default []) |
| 48 | 48 |
--dns-search list DNS search domains to use (default []) |
| ... | ... |
@@ -901,7 +901,18 @@ system's list of trusted CAs instead of enabling `--insecure-registry`. |
| 901 | 901 |
|
| 902 | 902 |
##### Legacy Registries |
| 903 | 903 |
|
| 904 |
-Enabling `--disable-legacy-registry` forces a docker daemon to only interact with registries which support the V2 protocol. Specifically, the daemon will not attempt `push`, `pull` and `login` to v1 registries. The exception to this is `search` which can still be performed on v1 registries. |
|
| 904 |
+Operations against registries supporting only the legacy v1 protocol are |
|
| 905 |
+disabled by default. Specifically, the daemon will not attempt `push`, |
|
| 906 |
+`pull` and `login` to v1 registries. The exception to this is `search` |
|
| 907 |
+which can still be performed on v1 registries. |
|
| 908 |
+ |
|
| 909 |
+Add `"disable-legacy-registry":false` to the [daemon configuration |
|
| 910 |
+file](#daemon-configuration-file), or set the |
|
| 911 |
+`--disable-legacy-registry=false` flag, if you need to interact with |
|
| 912 |
+registries that have not yet migrated to the v2 protocol. |
|
| 913 |
+ |
|
| 914 |
+Interaction v1 registries will no longer be supported in Docker v17.12, |
|
| 915 |
+and the `disable-legacy-registry` configuration option will be removed. |
|
| 905 | 916 |
|
| 906 | 917 |
#### Running a Docker daemon behind an HTTPS_PROXY |
| 907 | 918 |
|
| ... | ... |
@@ -13,6 +13,10 @@ import ( |
| 13 | 13 |
) |
| 14 | 14 |
|
| 15 | 15 |
func (s *DockerRegistryAuthHtpasswdSuite) TestLogoutWithExternalAuth(c *check.C) {
|
| 16 |
+ |
|
| 17 |
+ // @TODO TestLogoutWithExternalAuth expects docker to fall back to a v1 registry, so has to be updated for v17.12, when v1 registries are no longer supported |
|
| 18 |
+ s.d.StartWithBusybox(c, "--disable-legacy-registry=false") |
|
| 19 |
+ |
|
| 16 | 20 |
osPath := os.Getenv("PATH")
|
| 17 | 21 |
defer os.Setenv("PATH", osPath)
|
| 18 | 22 |
|
| ... | ... |
@@ -28,6 +32,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestLogoutWithExternalAuth(c *check.C) |
| 28 | 28 |
|
| 29 | 29 |
tmp, err := ioutil.TempDir("", "integration-cli-")
|
| 30 | 30 |
c.Assert(err, checker.IsNil) |
| 31 |
+ defer os.RemoveAll(tmp) |
|
| 31 | 32 |
|
| 32 | 33 |
externalAuthConfig := `{ "credsStore": "shell-test" }`
|
| 33 | 34 |
|
| ... | ... |
@@ -35,24 +40,27 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestLogoutWithExternalAuth(c *check.C) |
| 35 | 35 |
err = ioutil.WriteFile(configPath, []byte(externalAuthConfig), 0644) |
| 36 | 36 |
c.Assert(err, checker.IsNil) |
| 37 | 37 |
|
| 38 |
- dockerCmd(c, "--config", tmp, "login", "-u", s.reg.Username(), "-p", s.reg.Password(), privateRegistryURL) |
|
| 38 |
+ _, err = s.d.Cmd("--config", tmp, "login", "-u", s.reg.Username(), "-p", s.reg.Password(), privateRegistryURL)
|
|
| 39 |
+ c.Assert(err, checker.IsNil) |
|
| 39 | 40 |
|
| 40 | 41 |
b, err := ioutil.ReadFile(configPath) |
| 41 | 42 |
c.Assert(err, checker.IsNil) |
| 42 | 43 |
c.Assert(string(b), checker.Not(checker.Contains), "\"auth\":") |
| 43 | 44 |
c.Assert(string(b), checker.Contains, privateRegistryURL) |
| 44 | 45 |
|
| 45 |
- dockerCmd(c, "--config", tmp, "tag", "busybox", repoName) |
|
| 46 |
- dockerCmd(c, "--config", tmp, "push", repoName) |
|
| 47 |
- |
|
| 48 |
- dockerCmd(c, "--config", tmp, "logout", privateRegistryURL) |
|
| 46 |
+ _, err = s.d.Cmd("--config", tmp, "tag", "busybox", repoName)
|
|
| 47 |
+ c.Assert(err, checker.IsNil) |
|
| 48 |
+ _, err = s.d.Cmd("--config", tmp, "push", repoName)
|
|
| 49 |
+ c.Assert(err, checker.IsNil) |
|
| 50 |
+ _, err = s.d.Cmd("--config", tmp, "logout", privateRegistryURL)
|
|
| 51 |
+ c.Assert(err, checker.IsNil) |
|
| 49 | 52 |
|
| 50 | 53 |
b, err = ioutil.ReadFile(configPath) |
| 51 | 54 |
c.Assert(err, checker.IsNil) |
| 52 | 55 |
c.Assert(string(b), checker.Not(checker.Contains), privateRegistryURL) |
| 53 | 56 |
|
| 54 | 57 |
// check I cannot pull anymore |
| 55 |
- out, _, err := dockerCmdWithError("--config", tmp, "pull", repoName)
|
|
| 58 |
+ out, err := s.d.Cmd("--config", tmp, "pull", repoName)
|
|
| 56 | 59 |
c.Assert(err, check.NotNil, check.Commentf(out)) |
| 57 | 60 |
c.Assert(out, checker.Contains, "Error: image dockercli/busybox:authtest not found") |
| 58 | 61 |
} |
| ... | ... |
@@ -258,10 +258,13 @@ func (s *DockerHubPullSuite) TestPullClientDisconnect(c *check.C) {
|
| 258 | 258 |
} |
| 259 | 259 |
|
| 260 | 260 |
func (s *DockerRegistryAuthHtpasswdSuite) TestPullNoCredentialsNotFound(c *check.C) {
|
| 261 |
+ // @TODO TestPullNoCredentialsNotFound expects docker to fall back to a v1 registry, so has to be updated for v17.12, when v1 registries are no longer supported |
|
| 262 |
+ s.d.StartWithBusybox(c, "--disable-legacy-registry=false") |
|
| 263 |
+ |
|
| 261 | 264 |
// we don't care about the actual image, we just want to see image not found |
| 262 | 265 |
// because that means v2 call returned 401 and we fell back to v1 which usually |
| 263 | 266 |
// gives a 404 (in this case the test registry doesn't handle v1 at all) |
| 264 |
- out, _, err := dockerCmdWithError("pull", privateRegistryURL+"/busybox")
|
|
| 267 |
+ out, err := s.d.Cmd("pull", privateRegistryURL+"/busybox")
|
|
| 265 | 268 |
c.Assert(err, check.NotNil, check.Commentf(out)) |
| 266 | 269 |
c.Assert(out, checker.Contains, "Error: image busybox:latest not found") |
| 267 | 270 |
} |
| ... | ... |
@@ -98,8 +98,7 @@ func (s *DockerRegistrySuite) TestUserAgentPassThrough(c *check.C) {
|
| 98 | 98 |
"--insecure-registry", buildReg.URL(), |
| 99 | 99 |
"--insecure-registry", pullReg.URL(), |
| 100 | 100 |
"--insecure-registry", pushReg.URL(), |
| 101 |
- "--insecure-registry", loginReg.URL(), |
|
| 102 |
- "--disable-legacy-registry=true") |
|
| 101 |
+ "--insecure-registry", loginReg.URL()) |
|
| 103 | 102 |
|
| 104 | 103 |
dockerfileName, cleanup1, err := makefile(fmt.Sprintf("FROM %s", buildRepoName))
|
| 105 | 104 |
c.Assert(err, check.IsNil, check.Commentf("Unable to create test dockerfile"))
|
| ... | ... |
@@ -34,7 +34,7 @@ func makefile(contents string) (string, func(), error) {
|
| 34 | 34 |
|
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 |
-// TestV2Only ensures that a daemon in v2-only mode does not |
|
| 37 |
+// TestV2Only ensures that a daemon by default does not |
|
| 38 | 38 |
// attempt to contact any v1 registry endpoints. |
| 39 | 39 |
func (s *DockerRegistrySuite) TestV2Only(c *check.C) {
|
| 40 | 40 |
reg, err := registry.NewMock(c) |
| ... | ... |
@@ -51,7 +51,7 @@ func (s *DockerRegistrySuite) TestV2Only(c *check.C) {
|
| 51 | 51 |
|
| 52 | 52 |
repoName := fmt.Sprintf("%s/busybox", reg.URL())
|
| 53 | 53 |
|
| 54 |
- s.d.Start(c, "--insecure-registry", reg.URL(), "--disable-legacy-registry=true") |
|
| 54 |
+ s.d.Start(c, "--insecure-registry", reg.URL()) |
|
| 55 | 55 |
|
| 56 | 56 |
dockerfileName, cleanup, err := makefile(fmt.Sprintf("FROM %s/busybox", reg.URL()))
|
| 57 | 57 |
c.Assert(err, check.IsNil, check.Commentf("Unable to create test dockerfile"))
|
| ... | ... |
@@ -66,7 +66,7 @@ func (s *DockerRegistrySuite) TestV2Only(c *check.C) {
|
| 66 | 66 |
s.d.Cmd("pull", repoName)
|
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 |
-// TestV1 starts a daemon in 'normal' mode |
|
| 69 |
+// TestV1 starts a daemon with legacy registries enabled |
|
| 70 | 70 |
// and ensure v1 endpoints are hit for the following operations: |
| 71 | 71 |
// login, push, pull, build & run |
| 72 | 72 |
func (s *DockerRegistrySuite) TestV1(c *check.C) {
|
| ... | ... |
@@ -192,7 +192,7 @@ $ sudo dockerd --add-runtime runc=runc --add-runtime custom=/usr/local/bin/my-ru |
| 192 | 192 |
Default ulimits for containers. |
| 193 | 193 |
|
| 194 | 194 |
**--disable-legacy-registry**=*true*|*false* |
| 195 |
- Disable contacting legacy registries |
|
| 195 |
+ Disable contacting legacy registries. Default is `true`. |
|
| 196 | 196 |
|
| 197 | 197 |
**--dns**="" |
| 198 | 198 |
Force Docker to use specific DNS servers |
| ... | ... |
@@ -21,5 +21,5 @@ func cleanPath(s string) string {
|
| 21 | 21 |
|
| 22 | 22 |
// installCliPlatformFlags handles any platform specific flags for the service. |
| 23 | 23 |
func (options *ServiceOptions) installCliPlatformFlags(flags *pflag.FlagSet) {
|
| 24 |
- flags.BoolVar(&options.V2Only, "disable-legacy-registry", false, "Disable contacting legacy registries") |
|
| 24 |
+ flags.BoolVar(&options.V2Only, "disable-legacy-registry", true, "Disable contacting legacy registries") |
|
| 25 | 25 |
} |