Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins: fix "dial-stdio" feature or remove the feature #4708

Open
thaJeztah opened this issue Dec 12, 2023 · 2 comments
Open

plugins: fix "dial-stdio" feature or remove the feature #4708

thaJeztah opened this issue Dec 12, 2023 · 2 comments

Comments

@thaJeztah
Copy link
Member

Description

(I noticed this while reviewing #4599)

Relates to (#1661):

Commit ff2ed6e (#1745) disabled dial-stdio for plugins, adding an (undocumnented) DOCKER_CLI_PLUGIN_USE_DIAL_STDIO environment-variable to re-enable the feature. This feature was added in #1654, but caused CI failures and didn't work as anticipated.

We should either debug (and fix) the feature, or consider removing it.

@AkihiroSuda
Copy link
Collaborator

Does this proposal affect DOCKER_HOST=ssh:// ?

@thaJeztah
Copy link
Member Author

No it shouldn't, AFAICS, or at least it currently is disabled by default (which is why my eye dropped on it);

var opts []command.CLIOption
if os.Getenv("DOCKER_CLI_PLUGIN_USE_DIAL_STDIO") != "" {
opts = append(opts, withPluginClientConn(plugin.Name()))
}
err = tcmd.Initialize(opts...)

Setting that env-var enables this option, which is disabled by default because (from links above) it was broken;

func withPluginClientConn(name string) command.CLIOption {
return command.WithInitializeClient(func(dockerCli *command.DockerCli) (client.APIClient, error) {
cmd := "docker"
if x := os.Getenv(manager.ReexecEnvvar); x != "" {
cmd = x
}
var flags []string
// Accumulate all the global arguments, that is those
// up to (but not including) the plugin's name. This
// ensures that `docker system dial-stdio` is
// evaluating the same set of `--config`, `--tls*` etc
// global options as the plugin was called with, which
// in turn is the same as what the original docker
// invocation was passed.
for _, a := range os.Args[1:] {
if a == name {
break
}
flags = append(flags, a)
}
flags = append(flags, "system", "dial-stdio")
helper, err := connhelper.GetCommandConnectionHelper(cmd, flags...)
if err != nil {
return nil, err
}
return client.NewClientWithOpts(client.WithDialContext(helper.Dialer))
})
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants