Skip to content

Commit 77ca69b

Browse files
committed
docs/api: document /_ping?features=v1 endpoint
We've added a query parameter `features` to the `/_ping` endpoint that allows clients to ask the engine to list the configured engine features in the `/_ping` response. Document this change in `docs/api/version-history.md`, and update the swagger yaml accordingly. For Swagger, I've added a "separate" endpoint documenting the new behavior. This has to do with Swagger not supporting different responses for the same path (either based on query params or content-types/other headers) – see OAI/OpenAPI-Specification#146 This is supported in OpenAPI 3.0 (OAI/OpenAPI-Specification#146 (comment)), so we could fix this up in the future. Signed-off-by: Laura Brehm <[email protected]>
1 parent c8108ea commit 77ca69b

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

api/swagger.yaml

+93
Original file line numberDiff line numberDiff line change
@@ -9642,6 +9642,15 @@ paths:
96429642
This value is a recommendation as advertised by the daemon, and
96439643
it is up to the client to choose which builder to use.
96449644
default: "2"
9645+
Engine-Features:
9646+
type: "string"
9647+
description: |
9648+
List of engine features and whether they are enabled or not, containing
9649+
elements of the `features` field of the daemon's configuration file, as
9650+
well as features enabled via command line arguments when starting the daemon.
9651+
9652+
Represented as a comma separated (,) list of key-value pairs (`some-feature=true|false`),
9653+
e.g. `containerd-snapshotter=true,other-feature=false`.
96459654
Docker-Experimental:
96469655
type: "boolean"
96479656
description: "If the server is running with experimental mode enabled"
@@ -9709,6 +9718,90 @@ paths:
97099718
schema:
97109719
$ref: "#/definitions/ErrorResponse"
97119720
tags: ["System"]
9721+
# Using a zero-width character here to define a separate /_ping endpoint to describe the
9722+
# /_ping?features=v1 API since otherwise Swagger won't allow us to define multiple
9723+
# responses for the same endpoint depending on query parameter.
9724+
# This is however supported by OpenAPI v3.
9725+
# See: https://github.com/OAI/OpenAPI-Specification/issues/146
9726+
# and https://github.com/OAI/OpenAPI-Specification/issues/182
9727+
/_ping​:
9728+
get:
9729+
summary: "/_ping?features=v1"
9730+
description: |
9731+
This is the same endpoint as `GET /_ping`, but describes the different
9732+
response when it is called with the `features=v1` query parameter.
9733+
9734+
In this case, the daemon instead responds with a `Content-Type` of
9735+
`application/json` and writes a json map corresponding to the engine's
9736+
configured features in the response body.
9737+
operationId: "SystemPingFeatures"
9738+
produces: ["application/json"]
9739+
parameters:
9740+
- name: "features"
9741+
in: "query"
9742+
description: |
9743+
The name of the plugin. The `:latest` tag is optional, and is the
9744+
default if omitted.
9745+
# marked as required since this is a separate endpoint in the swagger yaml.
9746+
required: true
9747+
type: "string"
9748+
enum: ["v1"]
9749+
responses:
9750+
200:
9751+
description: "no error"
9752+
schema:
9753+
# map of strings to booleans
9754+
type: "object"
9755+
additionalProperties:
9756+
type: boolean
9757+
example:
9758+
containerd-snapshotter: true
9759+
other-feature: false
9760+
headers:
9761+
API-Version:
9762+
type: "string"
9763+
description: "Max API Version the server supports"
9764+
Builder-Version:
9765+
type: "string"
9766+
description: |
9767+
Default version of docker image builder
9768+
9769+
The default on Linux is version "2" (BuildKit), but the daemon
9770+
can be configured to recommend version "1" (classic Builder).
9771+
Windows does not yet support BuildKit for native Windows images,
9772+
and uses "1" (classic builder) as a default.
9773+
9774+
This value is a recommendation as advertised by the daemon, and
9775+
it is up to the client to choose which builder to use.
9776+
default: "2"
9777+
Docker-Experimental:
9778+
type: "boolean"
9779+
description: "If the server is running with experimental mode enabled"
9780+
Swarm:
9781+
type: "string"
9782+
enum: ["inactive", "pending", "error", "locked", "active/worker", "active/manager"]
9783+
description: |
9784+
Contains information about Swarm status of the daemon,
9785+
and if the daemon is acting as a manager or worker node.
9786+
default: "inactive"
9787+
Cache-Control:
9788+
type: "string"
9789+
default: "no-cache, no-store, must-revalidate"
9790+
Pragma:
9791+
type: "string"
9792+
default: "no-cache"
9793+
500:
9794+
description: "server error"
9795+
schema:
9796+
$ref: "#/definitions/ErrorResponse"
9797+
headers:
9798+
Cache-Control:
9799+
type: "string"
9800+
default: "no-cache, no-store, must-revalidate"
9801+
Pragma:
9802+
type: "string"
9803+
default: "no-cache"
9804+
tags: ["System"]
97129805
/commit:
97139806
post:
97149807
summary: "Create a new image from a container"

docs/api/version-history.md

+4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ keywords: "API, Docker, rcli, REST, documentation"
5858
the one that sorts first is picked.
5959
* `GET /containers/json` now returns a `GwPriority` field in `NetworkSettings`
6060
for each network endpoint.
61+
* `GET` `/_ping` endpoint now supports a `features` query parameter (currently only
62+
takes a constant `v1`, e.g. `GET /_ping?features=v1`). If set, instead of the
63+
response body containing `OK`, the daemon responds with with a json map
64+
containing the features configured in the daemon's `CommonConfig.Features` field.
6165

6266
## v1.47 API changes
6367

0 commit comments

Comments
 (0)