Skip to content

feat(serve): engine-backed read endpoints (docker ps, images, info, inspect)#47

Merged
us merged 1 commit into
mainfrom
feat/docker-api-read-endpoints
Jun 28, 2026
Merged

feat(serve): engine-backed read endpoints (docker ps, images, info, inspect)#47
us merged 1 commit into
mainfrom
feat/docker-api-read-endpoints

Conversation

@us

@us us commented Jun 28, 2026

Copy link
Copy Markdown
Owner

What

Continues Phase 1 of the Docker API daemon (#45): wires mocker serve to MockerKit so DOCKER_HOST tooling can read state. Now docker ps, docker info, container/image listing and inspect work against the socket.

Endpoints

  • GET /info, GET /containers/json, GET /images/json, GET /containers/{id}/json.
  • New list-item mappers (mapToContainerListItem, mapToImageListItem): Docker's list shapes differ from inspect — Command is a string (not array), Created a unix int, State a lowercase string, Ports use integer ports, image Id is sha256:-prefixed. Wrong types break docker ps / Jackson (docker-java) deserialization, so they're explicit.
  • NIO ↔ actor bridge: engine-backed routes hop to an async Task and write the response via the Channel (thread-safe), never the ChannelHandlerContext (event-loop-only — Swift 6 unsafe). Query parsing + percent-decode; ?all= honored.

Verification (tested from all angles)

  • swift test: 243/243 (4 new mapper-shape tests asserting Command-as-string, Created-as-int, integer ports, sha256 id, <none> fallback).
  • docker ps end-to-end against the socket → renders the Docker table (empty; runtime off). docker version negotiates. curl /containers/json[], curl /images/json → correct Docker ImageSummary JSON (sha256 Id, RepoTags, SharedSize -1), /info populated, nonexistent inspect → 404 {"message":...}.
  • Note: this machine's docker images uses an Apple/containerd image-store integration that bypasses DOCKER_HOST, so it isn't a clean e2e for the images view here — but /images/json is spec-correct (curl-verified) and standard docker/SDKs/testcontainers consume it directly.

Scope / next

Still read-only. Write lifecycle (/containers/create+start, /images/create pull) is Phase 2; streaming (/logs, /exec, /events) is Phase 3. Plan: .context/docker-api-plan.md.

…nspect)

Wire the Docker API server to MockerKit so DOCKER_HOST tooling can read state:
- GET /info, GET /containers/json (mapToContainerListItem), GET /images/json
  (mapToImageListItem), GET /containers/{id}/json (mapToContainerInspect).
- New Docker list-item mappers: the list shapes differ from inspect (Command is
  a string not array, Created a unix int, State a lowercase string, Ports use
  integer ports) — wrong types break docker ps / SDK deserialization.
- NIO <-> actor bridge: engine-backed routes hop to an async Task and write back
  via the Channel (thread-safe), never the ChannelHandlerContext (event-loop
  only). Query parsing + percent-decode; `?all=` honored.

Verified: `docker ps`/`docker version` end-to-end against the socket; curl
/containers/json -> [], /images/json -> Docker ImageSummary JSON, /info, and a
nonexistent inspect -> 404 {"message":...}. swift test 243/243 (incl. mapper
type tests).
@us us merged commit 62179e4 into main Jun 28, 2026
1 check passed
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.

1 participant