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

Always set the console size #3572

Merged
merged 1 commit into from
Apr 28, 2022
Merged

Always set the console size #3572

merged 1 commit into from
Apr 28, 2022

Conversation

rumpl
Copy link
Member

@rumpl rumpl commented Apr 28, 2022

- What I did

Removed the check for the OS when setting the console size on container creation. This check doesn't really make sense because the client doesn't know on what OS the daemon is really running. The daemon uses the console size on creation when available (on windows).

- How I did it
Checked the daemon code that it uses the console size only when available.

- How to verify it
docker run ... should still work

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)
image

@rumpl rumpl requested review from thaJeztah and ndeloof April 28, 2022 09:22
@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2022

Codecov Report

Merging #3572 (1410137) into master (fd2bc1f) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3572      +/-   ##
==========================================
+ Coverage   59.36%   59.37%   +0.01%     
==========================================
  Files         285      285              
  Lines       24097    24096       -1     
==========================================
+ Hits        14306    14308       +2     
+ Misses       8930     8928       -2     
+ Partials      861      860       -1     

Copy link
Contributor

@ndeloof ndeloof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch.

@thaJeztah
Copy link
Member

relates to #3554 (see the top description)

This change looks correct indeed (at least from the client side); what I noticed though is that the code you linked to is "on windows only"; https://github.com/moby/moby/blob/master/daemon/oci_windows.go#L127-L132

I see the corresponding implementation for linux does not take these values into account; https://github.com/moby/moby/blob/cb07afa3cc1cbc7adfab3ac65d92c497a3271b50/daemon/oci_linux.go#L1001

A quick look at the runtime-spec shows that the ConsoleSize field is not marked as platform-specific (i.e., it's available on both Windows and Linux; https://github.com/opencontainers/runtime-spec/blob/2cf6663ca299f8454318ea7c797a8039d013fe8c/specs-go/config.go#L35-L39

And the description of it also doesn't mention it to be "Windows only"; https://github.com/opencontainers/runtime-spec/blob/a3c33d663ebc56c4d35dbceaa447c7bf37f6fab3/config.md#process

So perhaps we should (as a follow-up);

  1. check if the option is "punched through" all the way in containerd and runc (verify if it takes effect if set)
  2. add a WithConsoleSize() option (to be used in the Linux implementation at least) in moby/moby
  3. after the above, we could make the "retry resize" loop "optional", based on API version (if the CLI connects with a daemon that has 2. above, then skip the resize retry code

It may be worth adding a comment to the lines changed here, that they currently are ignored on Linux daemons

if runtime.GOOS == "windows" {
hostConfig.ConsoleSize[0], hostConfig.ConsoleSize[1] = dockerCli.Out().GetTtySize()
}
hostConfig.ConsoleSize[0], hostConfig.ConsoleSize[1] = dockerCli.Out().GetTtySize()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment above; perhaps we should (until fixed) add a comment here that this option is currently ignored on Linux daemons

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment

This check doesn't really make sense because the client doesn't know on what
OS the daemon is really running.
The daemon uses the console size on creation when available (on windows).

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah thaJeztah merged commit a221771 into docker:master Apr 28, 2022
@thaJeztah thaJeztah added this to the 22.06.0 milestone May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants