Merge pull request #3619 from vvoland/3554-initial-console-size

cli/container: Fill ConsoleSize in create
This commit is contained in:
Sebastiaan van Stijn 2022-05-18 13:28:18 +02:00 committed by GitHub
commit 557e6a6793
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 6 deletions

View File

@ -263,6 +263,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.

View File

@ -117,7 +117,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()
@ -138,11 +137,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()