Skip to content

Commit 43fa6c1

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 ddfb0d0 commit 43fa6c1

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed

api/swagger.yaml

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