Expand description
Routing and rendering. Public so it can be tested without a socket. Docker Engine API routing and response rendering.
Everything here is pure: a path in, a Route out; a model’s structured answer in, the JSON
document the Docker CLI decodes out. The model names the things that matter to a user —
container names, images, states, ports — and NetGet fills the fields a Go decoder needs but
nobody reads (HostConfig, NetworkSettings, SharedSize, the Components list) with valid
defaults, so a model that forgets one cannot make docker ps fail to decode.
Every renderer validates first and returns a reason on refusal: an unknown container state, a port outside 1..=65535, a name with characters Docker itself refuses. Recursion: none.
Structs§
- Engine
Identity - Server identity used to fill
/versionand/infodefaults.
Enums§
- Route
- What a request path resolves to.
Constants§
- MIN_
API_ VERSION - Oldest API version accepted in a
/v1.xx/path prefix. The Docker CLI negotiates down to whatever/_pingadvertises, and 1.24 is the floor every current daemon still honours.
Functions§
- derived_
id - A 64-hex identifier derived from
seed, for objects the model named but gave no ID. - error_
body - The body of every Docker error:
{"message": "..."}. - parse_
version "1.45"→(1, 45).- render_
container GET /containers/{id}/jsonbody.- render_
container_ list GET /containers/jsonbody.- render_
images GET /images/jsonbody.- render_
info GET /infobody.- render_
networks GET /networksbody.- render_
version GET /versionbody.- render_
volumes GET /volumesbody.- resolve
- Resolve a method and an unversioned path.
- split_
version - Split an optional
/v<major>.<minor>prefix off a path.