Skip to main content

Module api

Module api 

Source
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§

EngineIdentity
Server identity used to fill /version and /info defaults.

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 /_ping advertises, 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}/json body.
render_container_list
GET /containers/json body.
render_images
GET /images/json body.
render_info
GET /info body.
render_networks
GET /networks body.
render_version
GET /version body.
render_volumes
GET /volumes body.
resolve
Resolve a method and an unversioned path.
split_version
Split an optional /v<major>.<minor> prefix off a path.