Skip to content

Commit a26d38a

Browse files
committed
docs/api: document /_ping?capabilities=1 endpoint
We've added a query parameter `capabilities` to the `/_ping` endpoint that allows clients to request capabilities that the engine supports 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 020da3f commit a26d38a

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

api/swagger.yaml

+94
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,24 @@ tags:
173173
x-displayName: "System"
174174

175175
definitions:
176+
Capabilities:
177+
description: "Represents engine capabilities"
178+
type: "object"
179+
properties:
180+
_v:
181+
description: "The version of capabilities this response represents."
182+
type: "object"
183+
x-nullable: false
184+
example: 1
185+
data:
186+
description: "The internal representation of the advertised engine capabilities."
187+
type: "object"
188+
properties:
189+
registry-client-auth:
190+
description: "Whether the engine supports client auth handling."
191+
type: "boolean"
192+
x-nullable: true
193+
example: true
176194
Port:
177195
type: "object"
178196
description: "An open port on a container"
@@ -9709,6 +9727,82 @@ paths:
97099727
schema:
97109728
$ref: "#/definitions/ErrorResponse"
97119729
tags: ["System"]
9730+
# Using a zero-width character here to define a separate /_ping endpoint to describe the
9731+
# /_ping?capabilities=1 API since otherwise Swagger won't allow us to define multiple
9732+
# responses for the same endpoint depending on query parameter.
9733+
# This is however supported by OpenAPI v3.
9734+
# See: https://github.com/OAI/OpenAPI-Specification/issues/146
9735+
# and https://github.com/OAI/OpenAPI-Specification/issues/182
9736+
/_ping​:
9737+
get:
9738+
summary: "/_ping?capabilities=1"
9739+
description: |
9740+
This is the same endpoint as `GET /_ping`, but describes the different
9741+
response when it is called with the `capabilities=1` query parameter.
9742+
9743+
In this case, the daemon instead responds with a `Content-Type` of
9744+
`application/json` and writes a json represenation of the engine's
9745+
capabilities in the response body.
9746+
operationId: "SystemPingCapabilities"
9747+
produces: ["application/json"]
9748+
parameters:
9749+
- name: "capabilities"
9750+
in: "query"
9751+
description: The capabilities API version being requested.
9752+
# marked as required since this is a separate endpoint in the swagger yaml.
9753+
required: true
9754+
type: "string"
9755+
enum: ["1"]
9756+
responses:
9757+
200:
9758+
description: "no error"
9759+
schema:
9760+
$ref: "#/definitions/Capabilities"
9761+
headers:
9762+
Api-Version:
9763+
type: "string"
9764+
description: "Max API Version the server supports"
9765+
Builder-Version:
9766+
type: "string"
9767+
description: |
9768+
Default version of docker image builder
9769+
9770+
The default on Linux is version "2" (BuildKit), but the daemon
9771+
can be configured to recommend version "1" (classic Builder).
9772+
Windows does not yet support BuildKit for native Windows images,
9773+
and uses "1" (classic builder) as a default.
9774+
9775+
This value is a recommendation as advertised by the daemon, and
9776+
it is up to the client to choose which builder to use.
9777+
default: "2"
9778+
Docker-Experimental:
9779+
type: "boolean"
9780+
description: "If the server is running with experimental mode enabled"
9781+
Swarm:
9782+
type: "string"
9783+
enum: ["inactive", "pending", "error", "locked", "active/worker", "active/manager"]
9784+
description: |
9785+
Contains information about Swarm status of the daemon,
9786+
and if the daemon is acting as a manager or worker node.
9787+
default: "inactive"
9788+
Cache-Control:
9789+
type: "string"
9790+
default: "no-cache, no-store, must-revalidate"
9791+
Pragma:
9792+
type: "string"
9793+
default: "no-cache"
9794+
500:
9795+
description: "server error"
9796+
schema:
9797+
$ref: "#/definitions/ErrorResponse"
9798+
headers:
9799+
Cache-Control:
9800+
type: "string"
9801+
default: "no-cache, no-store, must-revalidate"
9802+
Pragma:
9803+
type: "string"
9804+
default: "no-cache"
9805+
tags: ["System"]
97129806
/commit:
97139807
post:
97149808
summary: "Create a new image from a container"

docs/api/version-history.md

+4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ keywords: "API, Docker, rcli, REST, documentation"
6262
`GET /debug/pprof/profile`, `GET /debug/pprof/symbol`, `GET /debug/pprof/trace`,
6363
`GET /debug/pprof/{name}`) are now also accessible through the versioned-API
6464
paths (`/v<API-version>/<endpoint>`).
65+
* `GET` `/_ping` endpoint now optionally supports a `capabilities` query parameter
66+
(e.g. `GET /_ping?capabilities=1`). If set, instead of the response body containing
67+
`OK`, the daemon responds with a JSON Content-Type instead of `text/plain`, and
68+
includes the engine capabilities in the response.
6569

6670
## v1.47 API changes
6771

0 commit comments

Comments
 (0)