-
Notifications
You must be signed in to change notification settings - Fork 118
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
Docker API /events
Endpoint won't stop streaming
#7427
Comments
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; To confirm the issue was with the API, I ran a container that bind-mounted both the proxied ( 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 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
run
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
Client: Version: 27.2.0 API version: 1.47 Go version: go1.21.13 Git commit: 3ab4256 Built: Tue Aug 27 14:14:45 2024 OS/Arch: darwin/arm64 Context: default Server: Docker Desktop 4.34.2 (167172) Engine: Version: 27.2.0 API version: 1.47 (minimum version 1.24) Go version: go1.21.13 Git commit: 3ab5c7d Built: Tue Aug 27 14:15:41 2024 OS/Arch: linux/arm64 Experimental: false containerd: Version: 1.7.20 GitCommit: 8fc6bcff51318944179630522a095cc9dbf9f353 runc: Version: 1.1.13 GitCommit: v1.1.13-0-g58aa920 docker-init: Version: 0.19.0 GitCommit: de40ad0
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.
The text was updated successfully, but these errors were encountered: