Skip to content

Commit ff2ed6e

Browse files
author
Ian Campbell
committed
cli-plugins: disable use of dial-stdio
Since #1654 so far we've had problems with it not working on Windows (npipe lacked the `CloseRead` method) and problems with using tcp with tls (the tls connection also lacks `CloseRead`). Both of these were workedaround in #1718 which added a nop `CloseRead` method. However I am now seeing hangs (on Windows) where the `system dial-stdio` subprocess is not exiting (I'm unsure why so far). I think the 3rd problem found with this is an indication that `dial-stdio` is not quite ready for wider use outside of its initial usecase (support for `ssh://` URLs to connect to remote daemons). This change simply disables the `dial-stdio` path for all plugins. However rather than completely reverting 891b3d9 ("cli-plugins: use `docker system dial-stdio` to call the daemon") I've just disabled the functionality at the point of use and left in a trap door environment variable so that those who want to experiment with this mode (and perhaps fully debug it) have an easier path do doing so. The e2e test for this case is disabled unless the trap door envvar is set. I also renamed the test to clarify that it is about cli plugins. Signed-off-by: Ian Campbell <ijc@docker.com>
1 parent 651ccc0 commit ff2ed6e

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

cli-plugins/plugin/plugin.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ func runPlugin(dockerCli *command.DockerCli, plugin *cobra.Command, meta manager
3131
PersistentPreRunE = func(_ *cobra.Command, _ []string) error {
3232
var err error
3333
persistentPreRunOnce.Do(func() {
34-
err = tcmd.Initialize(withPluginClientConn(plugin.Name()))
34+
var opts []command.InitializeOpt
35+
if os.Getenv("DOCKER_CLI_PLUGIN_USE_DIAL_STDIO") != "" {
36+
opts = append(opts, withPluginClientConn(plugin.Name()))
37+
}
38+
err = tcmd.Initialize(opts...)
3539
})
3640
return err
3741
}

e2e/cli-plugins/dial_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ import (
1111
"gotest.tools/icmd"
1212
)
1313

14-
func TestDialStdio(t *testing.T) {
14+
func TestCLIPluginDialStdio(t *testing.T) {
15+
if os.Getenv("DOCKER_CLI_PLUGIN_USE_DIAL_STDIO") == "" {
16+
t.Skip("skipping plugin dial-stdio test since DOCKER_CLI_PLUGIN_USE_DIAL_STDIO is not set")
17+
}
18+
1519
// Run the helloworld plugin forcing /bin/true as the `system
1620
// dial-stdio` target. It should be passed all arguments from
1721
// before the `helloworld` arg, but not the --who=foo which

0 commit comments

Comments
 (0)