-
Notifications
You must be signed in to change notification settings - Fork 134
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
bugfix: attach container #297
Conversation
Thanks for this PR. We had an issue a while back where the logs emitted from the docker server on the aarch64 architecture didn't have a header: #285 For that reason we added a section into the newline parser to fallback to reading newlines instead of reading the length in the header. Could you change this solution to solve both #291 and #285 ? Perhaps we need to add a boolean field to the It's good to see though what the problem/solution is in #291 |
@fussybeaver The logs didn't had headers because it's behave the same way as From docker documentation: Logs returned as a stream in response body. Stream format when using a TTY When the TTY setting is enabled in POST /containers/create, the stream is not multiplexed. The data exchanged over the hijacked connection is simply the raw data from the process PTY and client's stdin. I don't think it's the library responsability to handle new incomming line, but rather the developers that call the function. People should stop comparing docker CLI with your client btw.. |
Looking at the code described on #285 A simple bugfix for him should have been: while let Some(Ok(value)) = logs.next().await {
let data = value.to_string();
print!("{:?}", data);
} Just print without new line |
cc @mrjackwills im taging you because it may introduce a bug in your app |
Thanks, I can try to build the application with this PR, and see what, if any, issues arise. Should be able to look at it this weekend. |
After rethinking about the problem i think i was wrong. This can be easily replicated with any http client, if we take the response as a stream. So i added a boolean |
This looks great, if we can get the log API tested successfully on aarch64 I'm happy to merge. |
I built oxker, for all the usual targets (linux x86, linux aarm64, linux armv6, windows) using; bollard = { git="https://github.com/leon3s/bollard", branch = "fix-attach-container"} And everything worked as expected, on all platforms, with no difference between this test build and the released application built with Bollard |
Hey related to this issue: #291
From docker documentation:
When the TTY setting is disabled in POST /containers/create, the HTTP Content-Type header is set to application/vnd.docker.multiplexed-stream and the stream over the hijacked connected is multiplexed to separate out stdout and stderr. The stream consists of a series of frames, each containing a header and a payload.
The header contains the information which the stream writes (stdout or stderr). It also contains the size of the associated frame encoded in the last four bytes (uint32).
The problem was only new line was send where some output is emited without any when we start a container with
Tty: true
.That why the prompt doesn't display because the output send doesn't have new line inside the buffer.