-
Notifications
You must be signed in to change notification settings - Fork 1.7k
exec_run unexpected empty output when container is running on a remote host #3332
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
Comments
After looking at this a bit more, it looks like the issue is that the code it trying to read data directly from the raw socket. So I suppose one potential solution here would be to stop reading directly from the socket, and use the buffered reader instead, although I have no idea of the impact of such a solution, I assume there must be some reason behind the current implementation of reading directly from the raw socket? I also identified a workaround, putting a quick sleep in the command seems to circumvent the issue:
|
Thanks for raising and debugging @antontornqvist.
Don't overestimate the current code, it might be entirely possible, that not all supported Docker environments were considered (and tested) in the implementation. Using a buffered reader sounds fine to me, do you want to look into providing a PR? |
Sure, I can look into fixing this. |
BTW #2042 looks like a duplicate |
Uh oh!
There was an error while loading. Please reload this page.
Hello
I am observing incorrect output from
exec_run
when done on a running container on a remote host. The container is running a standard ubuntu image.Connection to remote host is over an ssh forwarded unix socket.
Minimal reproducible example
Setup ssh forwarding:
ssh -L /tmp/docker-b.sock:/var/run/docker.sock -NTt -o ServerAliveInterval=30 -o ServerAliveCountMax=10 $DOCKER_HOST_B &
Connect to remote docker and execute command:
Troubleshooting
I ran strace on the python process from where I ran
exec_run
and observed the following,For unexpected output:
For expected output:
So it looks like when the HTTP header is split into two recv calls, the issue is observed.
Full strace output:
docker-issue-strace.log
Additional info
Python version:
Python 3.10.12
Docker python SDK version:
7.1.0
Container image:
ubuntu:22.04
Docker version:
The text was updated successfully, but these errors were encountered: