Closed HofmeisterAn closed 1 year ago
@galvesribeiro Could you please merge this fix? It will help us in improving container runtime support beyond Docker.
Hey @HofmeisterAn sorry, missed this.
Lets merge this as it should be the best practice regardless of how Docker works anyway.
However, I'd like to express my thoughts on Podman and other containers runtimes. This in particular was a very simple change and as I said it should be that way nonetheless but, I would rather avoid to have other-runtime-specific caveats into Docker.DotNet. The reason is because some things may be not compatible or behave differently making the support difficult.
In other hand, I do see as a good direction as part of the refactory to rethink the support of anything that runs under containerd
-based runtimes (i.e. soon WASM containers). We would need to think what is the common API surface (which will clearly exclude things like Swarm which would be left for an "extensions" package) among the runtime implementations and start from it.
Anyway, will digest this and get back to you later on Slack.
Thanks! Will cook a package later Today.
Thanks 👍.
I would rather avoid to have other-runtime-specific caveats into Docker.DotNet.
Yes, I agree and would also like to avoid it. However, Testcontainers for Node is a good example that there are likely very few, if any, runtime-specific cases required to support the essential features. If we can enhance runtime support through simple fixes, I believe it is something we should do. If it becomes more challenging or specific for a particular runtime, then of course it is out of scope.
What does this PR do?
The pull request addresses an issue where
Docker.DotNet
throws aSocketException
when attempting to read from a stream that has an initial content length of 0 bytes.Why is it important?
The Podman container runtime produces a slightly different HTTP response for the HTTP PUT API
/containers/{id}/archive
, where it sets theContent-Length
field to 0.Docker
Podman
Docker.DotNet
does not consider the initial content length and instead tries to read from the stream, resulting inSystem.Net.Http.HttpRequestException : Error while copying content to a stream
. Since the content length is 0, it is acceptable for Podman to terminate the HTTP connection.Related issues
-