Repository navigation
Description
Thanks to @fajxo for reporting and investigating this bug, providing the reproduction and end-to-end test results, and contributing the proposed fix in #196. This issue tracks the bug described in that PR.
Problem
Docker builds that stream their build-context tar in the body of POST /build can fail intermittently through socket-proxy when the Docker daemon starts its response before the upload is complete.
Symptoms reported by @fajxo in #196:
- The build fails during
[internal] load remote build contextwithunexpected EOF. - socket-proxy logs:
ReverseProxy read error during body copy: read unix @->/var/run/docker.sock: use of closed network connection
Affected usage includes the Moby Go client's ImageBuild with a BuildKit session and a request-body build context, as used by Arcane.
Cause
moby/moby#52364 replaced the build endpoint's response-buffering workaround with http.ResponseController.EnableFullDuplex(). This allows the daemon to send build progress while it is still reading the request body. The change is reported in #196 as affecting Docker Engine 29.5.0 and later.
socket-proxy's client-facing Go HTTP/1 server does not currently enable full-duplex handling. By default, Go may consume or close an unread request body when beginning the response, interfering with the reverse proxy's ongoing upload to the daemon. Enabling full duplex in the daemon does not enable it in the proxy.
See the Go documentation.
Expected behavior
An allowed request's body should continue to be forwarded completely while the backend response is streamed to the client. Existing IP, method, path, and bind-mount checks must remain in effect.
Reproduction and reported results
A minimal reproduction uses an HTTP backend on a Unix socket that enables full duplex, flushes its response headers, and then reads the request body. The client sends an initial part of the body and waits for the response before sending the remainder.
@fajxo reports in #196 the following end-to-end results on Docker Engine 29.9.2 using an Arcane-style BuildKit ImageBuild request:
| Endpoint | Successful builds | unexpected EOF |
|---|---|---|
| Docker socket directly | 20/20 | 0 |
| socket-proxy 1.13.2 | 119/150 | 31 |
| socket-proxy 1.13.2 with the proposed fix | 150/150 | 0 |
These results are reported by @fajxo and have not been independently reproduced here.
Proposed resolution
Enable full-duplex handling after the request passes all filtering checks and before calling socketProxy.ServeHTTP, as implemented by @fajxo in #196.
Regression coverage should verify both complete body delivery and receipt of the response before the remaining upload is sent. A timeout waiting for the response should fail the test rather than release the rest of the upload. Verify that the test fails without the fix and passes with it.
Related PR: #196
Activity
wollomatic commentedon Nov 7, 2026
https://github.com/wollomatic/socket-proxy/pkgs/container/socket-proxy/1519649457?tag=testing-10b89f5264b3a0afcdf2937affac58a0e3a410b8
Test image:
ghcr.io/wollomatic/socket-proxy:testing-10b89f5264b3a0afcdf2937affac58a0e3a410b8Build socket-proxy from upstream commit with full-duplex fix