diff --git a/cli/command/container/tty.go b/cli/command/container/tty.go index cb49ded8ef4f..dc4bf9d8f5ca 100644 --- a/cli/command/container/tty.go +++ b/cli/command/container/tty.go @@ -45,8 +45,6 @@ func MonitorTtySize(ctx context.Context, cli command.Cli, id string, isExec bool resizeTtyTo(ctx, cli.Client(), id, height, width, isExec) } - resizeTty() - if runtime.GOOS == "windows" { go func() { prevH, prevW := cli.Out().GetTtySize() @@ -70,6 +68,14 @@ func MonitorTtySize(ctx context.Context, cli command.Cli, id string, isExec bool } }() } + + go func() { + timeout := 1 * time.Millisecond + select { + case <-time.After(timeout): + resizeTty() + } + }() return nil }