fussybeaver / bollard

Docker daemon API in Rust
Apache License 2.0
858 stars 131 forks source link

one-shot stats fails with Docker 24.0.7 #346

Closed rolyatmax closed 10 months ago

rolyatmax commented 10 months ago

Docker 24.0.7 recently landed which includes this change to the docker stats functionality to speed up the collection of one-shot stats.

This new code path ends up returning a response that omits the name and id fields from the stats object, however. Docker seems to have been treating those fields as optional. Bollard doesn't, though. This means that this:

docker.stats(&container, Some(StatsOptions {
    stream: false,
    one_shot: true,
}))

always fails with a JsonDataError { message: "missing field 'name' at line ... }

UPDATE:

I've revised this issue description and the associated PR to reflect that the id field is also missing from the stats object when collecting one-shot stats.