Open dangrie158 opened 2 days ago
Thanks! Let me copy over my triage from the moby ticket for easier discoverability;
Thanks for reporting; this looks to be a bug in the API proxy that's part of Docker Desktop. Docker Desktop proxies the Docker Engine API to both bridge between the VM (in which the Engine is running), and to perform some transformations that are needed to map resources between the host and the VM (for example, converting paths on your host to their corresponding location inside the VM).
I tried reproducing this issue on Docker Engine runnine on Linux, which didn't show the problem;
curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.27/events?until=1726805738'
{"status":"create","id":"1c7b60bdf66be86f8abf2a149c8bcf4e30103f01a8cbac4ac162c3ebc20cba08","from":"nginx:alpine","Type":"container","Action":"create","Actor":{"ID":"1c7b60bdf66be86f8abf2a149c8bcf4e30103f01a8cbac4ac162c3ebc20cba08","Attributes":{"image":"nginx:alpine","maintainer":"NGINX Docker Maintainers \u003cdocker-maint@nginx.com\u003e","name":"foo"}},"scope":"local","time":1726768739,"timeNano":1726768739373677981}
{"Type":"network","Action":"connect","Actor":{"ID":"9fa82f4bc8aeb0d04978d20c7271e4ce5f2f3a6cd41a9ee738449c803fb3519c","Attributes":{"container":"1c7b60bdf66be86f8abf2a149c8bcf4e30103f01a8cbac4ac162c3ebc20cba08","name":"bridge","type":"bridge"}},"scope":"local","time":1726768739,"timeNano":1726768739465549183}
{"status":"start","id":"1c7b60bdf66be86f8abf2a149c8bcf4e30103f01a8cbac4ac162c3ebc20cba08","from":"nginx:alpine","Type":"container","Action":"start","Actor":{"ID":"1c7b60bdf66be86f8abf2a149c8bcf4e30103f01a8cbac4ac162c3ebc20cba08","Attributes":{"image":"nginx:alpine","maintainer":"NGINX Docker Maintainers \u003cdocker-maint@nginx.com\u003e","name":"foo"}},"scope":"local","time":1726768739,"timeNano":1726768739739040445}
When doing the same on Docker Desktop (on macOS in my case), I was able to reproduce the issue; curl
showed the response but did not disconnect.
To confirm the issue was with the API, I ran a container that bind-mounted both the proxied (/var/run/docker.sock
) and the non-proxied (/var/run/docker.sock.raw
) API socket;
docker run -it --rm \
-v /var/run/docker.sock.raw:/var/run/docker.sock.raw \
-v /var/run/docker.sock:/var/run/docker.sock \
alpine
Then, inside the container, I installed curl
, and tried the same request against both;
apk add --no-cache -qq curl
# connect to the raw (non-proxied) socket;
curl -sS --unix-socket /var/run/docker.sock.raw 'http://localhost/v1.27/events?until=1726805738'
# {"Type":"network",...
# {"Type":"container",,..
# connect to the proxied socket;
curl -sS --unix-socket /var/run/docker.sock 'http://localhost/v1.27/events?until=1726805738'
# {"Type":"network",...
# {"Type":"container",,..
^C
Description
The /events/ endpoint has a until parameter that according to the docs
(emphasis mine).
However in recent versions there seems to be a regression where the stream will not be closed by the server. I relied on this behaviour previously so I know it worked at least up until some time back in September 2023.
Specifying any other API version in the URL does not seem to make a difference
Reproduce
curl --unix-socket /var/run/docker.sock 'http://localhost/v1.27/events?until=1726805738'
Expected behavior
The stream should be closed (i.e. the
curl
process should exit)docker version
docker info
Diagnostics ID
1E3E03C8-5A9C-4B69-9376-8FF133A841D2/20240920085405
Additional Info
This was previously reported im moby/moby#48536 but diagnosed to be an issue with the API Proxy within docker desktop.