feat(atlas): Docker collector - containers as graph assets - #2046
Open
asdf8675309 wants to merge 1 commit into
Open
feat(atlas): Docker collector - containers as graph assets#2046asdf8675309 wants to merge 1 commit into
asdf8675309 wants to merge 1 commit into
Conversation
Adds collectors/Docker.ts, a standalone collector for the local Docker daemon. It enumerates ALL containers (docker ps -aq, running or not), reads canonical JSON from one batched docker inspect, and emits one asset per container plus a RUNS_ON edge to this machine. - Keyed by container NAME, not ID. A recreate (compose up, image upgrade) rotates the ID but keeps the name, and keying by ID would churn a fresh asset per recreate. Same reason Launchd.ts keys on Label. - Attrs capture every cheap connection signal: image, state, running, ports (published and exposed-unpublished), networks, mount destinations (never host source paths), restart policy, compose project, created/started timestamps. - Degrades, never throws, when the docker CLI is absent or the daemon is not running. Both are normal states on most installs — the same DEGRADED contract Github.ts and Launchd.ts use, so an absent source can never sweep prior observations. - A container removed between ps and inspect marks the run incomplete (complete: false) instead of sweeping on a racy view. Zero exit with unparseable inspect output still throws (contract regression, not an absent source). Registered in Atlas.ts alongside the existing collectors. New row in the AtlasSystem.md collector table, frontmatter stamped per pai-freshness-v1. Verified on a live daemon (Docker Engine 29.7.2, macOS, Bun 1.3.14): full sync run complete and swept, one compose-managed postgres container enumerated with image/ports/networks/mounts/restart-policy attrs and an active RUNS_ON edge to the machine asset. With the CLI absent from PATH the collector returns the degraded result without throwing. Strict tsc pass over the whole ATLAS tree.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Atlas has no visibility into Docker. A machine running containers has real assets — databases, services, published ports — that never appear in the asset graph, so
owns/blast/stalequeries are blind to them.Change
One new collector,
LIFEOS/ATLAS/collectors/Docker.ts, plus its registration line inAtlas.tsand a collector-table row (with freshness stamp) inAtlasSystem.md.docker ps -aq, running or not), then reads canonical JSON from one batcheddocker inspect— no--formattemplates, whose field names drift across Docker versions.docker:container:<name>— name, not ID. A recreate (compose up, image upgrade) rotates the ID but keeps the name, and keying by ID would churn a fresh asset per recreate. Same reasonLaunchd.tskeys on Label.RUNS_ONedge per container to the local machine asset, the wayLaunchd.tsdoes it.Why it's safe
complete: false, empty) — the same contractGithub.tsandLaunchd.tsalready use.atlas synccannot exit non-zero because a machine has no Docker, and an absent source can never sweep prior observations.psandinspectmarks the runcomplete: false— no sweep on a racy view; prior graph state stays intact.inspectexiting 0 with unparseable output throws loudly (contract regression, not an absent source) — the same splitGithub.tsdraws.Verification
Tested on macOS, Docker Engine 29.7.2, Bun 1.3.14. The fork has no test runner, so this table is the reviewable proof.
✓ docker: 2 assets, 1 edges (complete, swept), exit 0docker:container:<name>active, attrs carry image/state/ports (v4+v6 bindings)/networks/mounts/restart-policy/compose-project; activeRUNS_ONedge to the machine asset{"complete":false,"assets":[],"edges":[]}— no throwcomplete: true, machine asset only (early-return code path; not live-tested — the test machine has a container)LIFEOS/ATLASScope
No change to
Store.ts, the CLI surface, or any existing collector. The two edited files change by 3 code lines total (one import + one registration entry) plus one doc row. No new dependency —Bun.spawnand thedockerCLI only.