Skip to content

fix(events): use Actor.ID instead of deprecated top-level id field - #22

Merged
obeone merged 1 commit into
mainfrom
fix/issue-20-event-id-deprecated
Mar 2, 2026
Merged

fix(events): use Actor.ID instead of deprecated top-level id field#22
obeone merged 1 commit into
mainfrom
fix/issue-20-event-id-deprecated

Conversation

@obeone

@obeone obeone commented Mar 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace all usages of the deprecated event["id"] with event["Actor"]["ID"] in monitor_events()
  • Add a fallback to the legacy id field for backward compatibility with older Docker engines
  • Add a guard clause to skip events that have no resolvable container ID

Context

Docker Engine API 1.47 (shipped with Docker Engine 28+) deprecated the top-level id field on container event payloads in favour of Actor.ID. On Docker Engine 29.2.1+, the field is no longer present, causing a KeyError: 'id' crash on every container event.

See: https://docs.docker.com/engine/deprecated/#ambiguous-event-fields-in-api

Test plan

  • Run the daemon against Docker Engine ≥ 28 (where id is absent) and verify no KeyError is raised on container start/stop/die events
  • Run the daemon against an older Docker Engine and verify the fallback path works correctly
  • Run existing test suite: pytest tests/

Closes #20

Docker Engine API 1.47+ dropped the top-level `id` field from container
event payloads in favour of `Actor.ID`, causing a KeyError crash in
monitor_events() on Docker Engine 29.2.1+.

Extract the container ID from Actor.ID with a fallback to the legacy id
field so the daemon works on both old and new engine versions.

Closes #20
@obeone
obeone merged commit 89962e6 into main Mar 2, 2026
4 checks passed
@obeone
obeone deleted the fix/issue-20-event-id-deprecated branch March 2, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KeyError: 'id' in monitor_events

1 participant