feat(serve): engine-backed read endpoints (docker ps, images, info, inspect)#47
Merged
Conversation
…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).
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
Continues Phase 1 of the Docker API daemon (#45): wires
mocker serveto MockerKit soDOCKER_HOSTtooling can read state. Nowdocker 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.mapToContainerListItem,mapToImageListItem): Docker's list shapes differ from inspect —Commandis a string (not array),Createda unix int,Statea lowercase string,Portsuse integer ports, imageIdissha256:-prefixed. Wrong types breakdocker ps/ Jackson (docker-java) deserialization, so they're explicit.Taskand write the response via the Channel (thread-safe), never theChannelHandlerContext(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 psend-to-end against the socket → renders the Docker table (empty; runtime off).docker versionnegotiates.curl /containers/json→[],curl /images/json→ correct DockerImageSummaryJSON (sha256 Id, RepoTags, SharedSize -1),/infopopulated, nonexistent inspect →404 {"message":...}.docker imagesuses an Apple/containerd image-store integration that bypassesDOCKER_HOST, so it isn't a clean e2e for the images view here — but/images/jsonis spec-correct (curl-verified) and standard docker/SDKs/testcontainers consume it directly.Scope / next
Still read-only. Write lifecycle (
/containers/create+start,/images/createpull) is Phase 2; streaming (/logs,/exec,/events) is Phase 3. Plan:.context/docker-api-plan.md.