diff --git a/daemon/graphdriver/plugin.go b/daemon/graphdriver/plugin.go index 33108371bf98e..f39fd04e8c06c 100644 --- a/daemon/graphdriver/plugin.go +++ b/daemon/graphdriver/plugin.go @@ -2,6 +2,7 @@ package graphdriver // import "github.com/docker/docker/daemon/graphdriver" import ( "fmt" + "os" "path/filepath" "github.com/docker/docker/errdefs" @@ -12,6 +13,9 @@ import ( ) func lookupPlugin(name string, pg plugingetter.PluginGetter, config Options) (Driver, error) { + if os.Getenv("DOCKERD_DEPRECATED_GRAPHDRIVER_PLUGINS") == "" { + return nil, fmt.Errorf("DEPRECATED: Experimental graphdriver plugins are deprecated, and disabled by default. This feature will be removed in the next release. See https://docs.docker.com/go/deprecated/") + } if !config.ExperimentalEnabled { return nil, fmt.Errorf("graphdriver plugins are only supported with experimental mode") } diff --git a/integration/plugin/graphdriver/external_test.go b/integration/plugin/graphdriver/external_test.go index f2228f89f7bd9..b77e7dfce7716 100644 --- a/integration/plugin/graphdriver/external_test.go +++ b/integration/plugin/graphdriver/external_test.go @@ -60,7 +60,7 @@ func TestExternalGraphDriver(t *testing.T) { sserver := setupPluginViaSpecFile(t, ec) jserver := setupPluginViaJSONFile(t, ec) // Create daemon - d := daemon.New(t, daemon.WithExperimental()) + d := daemon.New(t, daemon.WithExperimental(), daemon.WithEnvVars("DOCKERD_DEPRECATED_GRAPHDRIVER_PLUGINS=1")) c := d.NewClientT(t) for _, tc := range []struct { @@ -418,16 +418,16 @@ func TestGraphdriverPluginV2(t *testing.T) { ctx := testutil.StartSpan(baseContext, t) - d := daemon.New(t, daemon.WithExperimental()) + d := daemon.New(t, daemon.WithExperimental(), daemon.WithEnvVars("DOCKERD_DEPRECATED_GRAPHDRIVER_PLUGINS=1")) d.Start(t) defer d.Stop(t) - client := d.NewClientT(t) - defer client.Close() + apiClient := d.NewClientT(t) + defer apiClient.Close() // install the plugin plugin := "cpuguy83/docker-overlay2-graphdriver-plugin" - responseReader, err := client.PluginInstall(ctx, plugin, types.PluginInstallOptions{ + responseReader, err := apiClient.PluginInstall(ctx, plugin, types.PluginInstallOptions{ RemoteRef: plugin, AcceptAllPermissions: true, }) @@ -441,7 +441,7 @@ func TestGraphdriverPluginV2(t *testing.T) { d.Stop(t) d.StartWithBusybox(ctx, t, "-s", plugin) - testGraphDriver(ctx, t, client, plugin, nil) + testGraphDriver(ctx, t, apiClient, plugin, nil) } func testGraphDriver(ctx context.Context, t *testing.T, c client.APIClient, driverName string, afterContainerRunFn func(*testing.T)) {