Skip to content

Commit 36d9646

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 6864b60 commit 36d9646

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

api/swagger.yaml

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

docs/api/version-history.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ keywords: "API, Docker, rcli, REST, documentation"
5050
daemon has experimental features enabled.
5151
* `GET /networks/{id}` now returns an `EnableIPv4` field showing whether the
5252
network has IPv4 IPAM enabled.
53+
* `GET` `/_ping` endpoint now supports a `features` query parameter (currently only
54+
takes a constant `v1`, e.g. `GET /_ping?features=v1`). If set, instead of the
55+
response body containing `OK`, the daemon responds with with a json map
56+
containing the features configured in the daemon's `CommonConfig.Features` field.
5357

5458
## v1.47 API changes
5559

0 commit comments

Comments
 (0)