From 6d3bda1e7c71b47c4751de19210d074520274c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Wed, 18 May 2022 12:48:02 +0200 Subject: [PATCH] cli/container: Move filling ConsoleSize to create MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes the containers have an expected console size not only for `run` but also for `create`. Also remove the comment, as this is no longer ignored on Linux daemon since e994efcf64c133de799f16f5cd6feb1fc41fade4 Signed-off-by: Paweł Gronowski --- cli/command/container/create.go | 2 ++ cli/command/container/run.go | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/cli/command/container/create.go b/cli/command/container/create.go index b8bf86e2ac..bd0035e49a 100644 --- a/cli/command/container/create.go +++ b/cli/command/container/create.go @@ -261,6 +261,8 @@ func createContainer(ctx context.Context, dockerCli command.Cli, containerConfig } } + hostConfig.ConsoleSize[0], hostConfig.ConsoleSize[1] = dockerCli.Out().GetTtySize() + response, err := dockerCli.Client().ContainerCreate(ctx, config, hostConfig, networkingConfig, platform, opts.name) if err != nil { // Pull image if it does not exist locally and we have the PullImageMissing option. Default behavior. diff --git a/cli/command/container/run.go b/cli/command/container/run.go index 698e2a8c38..6faaf1ae0a 100644 --- a/cli/command/container/run.go +++ b/cli/command/container/run.go @@ -97,7 +97,6 @@ func runRun(dockerCli command.Cli, flags *pflag.FlagSet, ropts *runOptions, copt // nolint: gocyclo func runContainer(dockerCli command.Cli, opts *runOptions, copts *containerOptions, containerConfig *containerConfig) error { config := containerConfig.Config - hostConfig := containerConfig.HostConfig stdout, stderr := dockerCli.Out(), dockerCli.Err() client := dockerCli.Client() @@ -118,11 +117,6 @@ func runContainer(dockerCli command.Cli, opts *runOptions, copts *containerOptio config.StdinOnce = false } - // Currently ignored on Linux daemons, in the Linux case the TTY size is - // set by calling MonitorTtySize. - // A Windows daemon will create the process with the right TTY size - hostConfig.ConsoleSize[0], hostConfig.ConsoleSize[1] = dockerCli.Out().GetTtySize() - ctx, cancelFun := context.WithCancel(context.Background()) defer cancelFun()