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
Control characters printed to shell prompt with 'docker logs' command #30137
Comments
(fwiw - testing on 17.06.0-rc1) |
Same, I can repro. Almost certainly related to powershell doing something weird w/ control characters. Getting logs for a TTY is a mess if there are control characters involved; try doing |
I see it too. Also:
Need to lookup what those escape codes do but apparently one of them is a |
The issue is that the Powershell prompt includes several AFAICT the
There are several instance of the |
Not PS specific, you can reproduce e.g. with:
So neither |
It's not clear to me that this is a bug, or if it were what docker could do about it. One person's escape code is another person's binary data, so in trying to "fix" the former we would inevitably be corrupting the latter. |
@ijc25 is it that PowerShell uses different escape codes than a Linux shell? So, when printing the same logs from a PowerShell session on the host, it properly "translates"? |
On bash the prompt is just whatever is in I don't know much about PowerShell, including where gets its prompt from (it's nothing I can see in the output of |
BTW I'm not 100% sure this is about the "prompt" per-se, but at the least it is about outputting of escape codes in the normal course of using the shell. |
Yeah I'm gonna agree and says |
Agreed; still curious how it acts on a PowerShell shell on the host (but that's just my curiosity) 😄 @pcgeek86 I'm closing this per the discussion above, but thanks so much for reporting; also feel free to continue the discussion 👍 |
A feature request for a @thaJeztah When running on the host and shell (including PowerShell) will have those escape codes captured and interpreted by the terminal and PowerShell will, presumably, be expecting and thus consume/act upon the answering escape codes rather than accepting them as regular input. The issue with |
something like |
I have no particular opinion on the naming or the default, but yes, that sort of thing. |
I believe we've encountered a related problem when running:
Of note, "pipeline" jobs which use a Jenkinsfile don't exhibit the problem. We've opened an issue with Cloudbee's who do not seem to have encountered this issue before. Can anyone confirm that this might be related to this issue? Or should I open a new issue? |
@solvingj if that's the output of |
@thaJeztah we also met this issue on windows run "docker exec", how to mitigate this issue? I mean remove the unwanted from output |
@solvingj may I know have you resolved the issue? |
These answers may help if you're using PowerShell; https://stackoverflow.com/a/51681675 https://stackoverflow.com/a/51683794 |
I see there's some discussion around ANSI escape sequences in the PowerShell issue tracker here; PowerShell/PowerShell#13071 |
For posterity, my issue was simply because I was passing |
Yes, processes in the container may produce different output depending on if h there's a TTY attached to the container or not. Good to hear you resolved the situation for your use case |
I just had the same issue, running linux container with aws cli in it. removing the "t" (from -it) fixed my issue. e.g.
remove -t
|
Description
Control characters are being printed to the shell prompt when running
docker logs
.Steps to reproduce the issue:
docker run --name ps --interactive --tty microsoft/powershell
1..999 | % { echo $_; sleep 1 }
CTRL + P, CTRL + Q
docker logs ps
Describe the results you received:
After running step #4 in the repro, I receive some control characters printed to the shell prompt.
Describe the results you expected:
I would expect the shell prompt to be empty, after running the
docker logs
command.Output of
docker version
:Docker Version Output
Output of
docker info
:Docker Info Output
Additional environment details (AWS, VirtualBox, physical, etc.):
Cheers,
Trevor Sullivan
Docker Captain
Microsoft MVP: Cloud & Data Center Management
https://trevorsullivan.net
https://twitter.com/pcgeek86
The text was updated successfully, but these errors were encountered: