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

cli/container: Fill ConsoleSize in create #3619

Merged
merged 1 commit into from
May 18, 2022

Conversation

vvoland
Copy link
Collaborator

@vvoland vvoland commented May 18, 2022

Related to moby/moby#43593

- What I did
Fill HostConfig.ConsoleSize for both docker run and docker create

- How I did it
Move the code that sets the ConsoleSize from runContainer to createContainer.
This does not impact the runContainer, as it calls createContainer anyway.

- How to verify it

# Change terminal size from the default 24x80
docker create -t ubuntu sh -c 'tput lines; tput cols'
docker start <id>
docker logs <id>
# Check if the printed size is correct

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

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 <[email protected]>
@vvoland vvoland requested a review from thaJeztah May 18, 2022 11:22
@thaJeztah thaJeztah added this to the 22.06.0 milestone May 18, 2022
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 557e6a6 into docker:master May 18, 2022
@vvoland
Copy link
Collaborator Author

vvoland commented May 18, 2022

Just wondering if this makes sense if config.Tty is false?

@@ -261,6 +261,8 @@ func createContainer(ctx context.Context, dockerCli command.Cli, containerConfig
}
}

hostConfig.ConsoleSize[0], hostConfig.ConsoleSize[1] = dockerCli.Out().GetTtySize()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Shouldn't this be filled only if config.Tty?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I was somewhat looking at that; then again, if I'm not mistaken, that's also gated at the daemon-side (so it only applies the options if there's a TTY), and possibly (need to check) again on the runtime (containerd) side.

The code was already taking this approach, so I didn't consider it a blocker, but we could look into different scenarios (feel free to do so 😃).

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.

2 participants