Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Docker Engine Swarm API
version: '1.33'
x-logo:
url: https://docs.docker.com/images/logo-docker-main.png
description: 'The Engine API is an HTTP API served by Docker Engine. It is the API the Docker client uses to communicate with the Engine, so everything the Docker client can do can be done with the API.
Most of the client''s commands map directly to API endpoints (e.g. `docker ps` is `GET /containers/json`). The notable exception is running containers, which consists of several API calls.
# Errors
The API uses standard HTTP status codes to indicate the success or failure of the API call. The body of the response will be JSON in the following format:
```
{
"message": "page not found"
}
```
# Versioning
The API is usually changed in each release of Docker, so API calls are versioned to ensure that clients don''t break.
For Docker Engine 17.09, the API version is 1.32. To lock to this version, you prefix the URL with `/v1.32`. For example, calling `/info` is the same as calling `/v1.32/info`.
Engine releases in the near future should support this version of the API, so your client will continue to work even if it is talking to a newer Engine.
In previous versions of Docker, it was possible to access the API without providing a version. This behaviour is now deprecated will be removed in a future version of Docker.
The API uses an open schema model, which means server may add extra properties to responses. Likewise, the server will ignore any extra query parameters and request body properties. When you write clients, you need to ignore additional properties in responses to ensure they do not break when talking to newer Docker daemons.
This documentation is for version 1.33 of the API. Use this table to find documentation for previous versions of the API:
Docker version | API version | Changes
----------------|-------------|---------
17.09.x | 1.31 | API changes
17.07.x | 1.31 | API changes
17.06.x | 1.30 | API changes
17.05.x | 1.29 | API changes
17.04.x | 1.28 | API changes
17.03.1 | 1.27 | API changes
1.13.1 & 17.03.0 | 1.26 | API changes
1.13.0 | 1.25 | API changes
1.12.x | 1.24 | API changes
1.11.x | 1.23 | API changes
1.10.x | 1.22 | API changes
1.9.x | 1.21 | API changes
1.8.x | 1.20 | API changes
1.7.x | 1.19 | API changes
1.6.x | 1.18 | API changes
# Authentication
Authentication for registries is handled client side. The client has to send authentication details to various endpoints that need to communicate with registries, such as `POST /images/(name)/push`. These are sent as `X-Registry-Auth` header as a Base64 encoded (JSON) string with the following structure:
```
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
The `serveraddress` is a domain/IP without a protocol. Throughout this structure, double quotes are required.
If you have already got an identity token from the `/auth` endpoint, you can just pass this instead of credentials:
```
{
"identitytoken": "9cbaf023786cd7..."
}
```'
servers:
- url: /v1.33
tags:
- name: Swarm
x-displayName: Swarm
description: Engines can be clustered together in a swarm. See the swarm mode documentation for more information.
paths:
/swarm:
get:
summary: Inspect swarm
operationId: SwarmInspect
responses:
200:
description: no error
content:
application/json:
schema:
$ref: '#/components/schemas/Swarm'
text/plain:
schema:
$ref: '#/components/schemas/Swarm'
404:
description: no such swarm
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
text/plain:
schema:
$ref: '#/components/schemas/ErrorResponse'
500:
description: server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
text/plain:
schema:
$ref: '#/components/schemas/ErrorResponse'
503:
description: node is not part of a swarm
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
text/plain:
schema:
$ref: '#/components/schemas/ErrorResponse'
tags:
- Swarm
/swarm/init:
post:
summary: Initialize a new swarm
operationId: SwarmInit
responses:
200:
description: no error
content:
application/json:
schema:
description: The node ID
type: string
example: 7v2t30z9blmxuhnyo6s4cpenp
text/plain:
schema:
description: The node ID
type: string
example: 7v2t30z9blmxuhnyo6s4cpenp
400:
description: bad parameter
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
text/plain:
schema:
$ref: '#/components/schemas/ErrorResponse'
500:
description: server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
text/plain:
schema:
$ref: '#/components/schemas/ErrorResponse'
503:
description: node is already part of a swarm
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
text/plain:
schema:
$ref: '#/components/schemas/ErrorResponse'
tags:
- Swarm
requestBody:
content:
application/json:
schema:
type: object
properties:
ListenAddr:
description: Listen address used for inter-manager communication, as well as determining the networking interface used for the VXLAN Tunnel Endpoint (VTEP). This can either be an address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port number, like `eth0:4567`. If the port number is omitted, the default swarm listening port is used.
type: string
AdvertiseAddr:
description: Externally reachable address advertised to other nodes. This can either be an address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port number, like `eth0:4567`. If the port number is omitted, the port number from the listen address is used. If `AdvertiseAddr` is not specified, it will be automatically detected when possible.
type: string
DataPathAddr:
description: 'Address or interface to use for data path traffic (format: `<ip|interface>`), for example, `192.168.1.1`,
or an interface, like `eth0`. If `DataPathAddr` is unspecified, the same address as `AdvertiseAddr`
is used.
The `DataPathAddr` specifies the address that global scope network drivers will publish towards other
nodes in order to reach the containers running on this node. Using this parameter it is possible to
separate the container data traffic from the management traffic of the cluster.
'
type: string
ForceNewCluster:
description: Force creation of a new swarm.
type: boolean
Spec:
$ref: '#/components/schemas/SwarmSpec'
example:
ListenAddr: 0.0.0.0:2377
AdvertiseAddr: 192.168.1.1:2377
ForceNewCluster: false
Spec:
Orchestration: {}
Raft: {}
Dispatcher: {}
CAConfig: {}
EncryptionConfig:
AutoLockManagers: false
text/plain:
schema:
type: object
properties:
ListenAddr:
description: Listen address used for inter-manager communication, as well as determining the networking interface used for the VXLAN Tunnel Endpoint (VTEP). This can either be an address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port number, like `eth0:4567`. If the port number is omitted, the default swarm listening port is used.
type: string
AdvertiseAddr:
description: Externally reachable address advertised to other nodes. This can either be an address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port number, like `eth0:4567`. If the port number is omitted, the port number from the listen address is used. If `AdvertiseAddr` is not specified, it will be automatically detected when possible.
type: string
DataPathAddr:
description: 'Address or interface to use for data path traffic (format: `<ip|interface>`), for example, `192.168.1.1`,
or an interface, like `eth0`. If `DataPathAddr` is unspecified, the same address as `AdvertiseAddr`
is used.
The `DataPathAddr` specifies the address that global scope network drivers will publish towards other
nodes in order to reach the containers running on this node. Using this parameter it is possible to
separate the container data traffic from the management traffic of the cluster.
'
type: string
ForceNewCluster:
description: Force creation of a new swarm.
type: boolean
Spec:
$ref: '#/components/schemas/SwarmSpec'
example:
ListenAddr: 0.0.0.0:2377
AdvertiseAddr: 192.168.1.1:2377
ForceNewCluster: false
Spec:
Orchestration: {}
Raft: {}
Dispatcher: {}
CAConfig: {}
EncryptionConfig:
AutoLockManagers: false
required: true
/swarm/join:
post:
summary: Join an existing swarm
operationId: SwarmJoin
responses:
200:
description: no error
400:
description: bad parameter
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
text/plain:
schema:
$ref: '#/components/schemas/ErrorResponse'
500:
description: server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
text/plain:
schema:
$ref: '#/components/schemas/ErrorResponse'
503:
description: node is already part of a swarm
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
text/plain:
schema:
$ref: '#/components/schemas/ErrorResponse'
tags:
- Swarm
requestBody:
content:
application/json:
schema:
type: object
properties:
ListenAddr:
description: Listen address used for inter-manager communication if the node gets promoted to manager, as well as determining the networking interface used for the VXLAN Tunnel Endpoint (VTEP).
type: string
AdvertiseAddr:
description: Externally reachable address advertised to other nodes. This can either be an address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port number, like `eth0:4567`. If the port number is omitted, the port number from the listen address is used. If `AdvertiseAddr` is not specified, it will be automatically detected when possible.
type: string
DataPathAddr:
description: 'Address or interface to use for data path traffic (format: `<ip|interface>`), for example, `192.168.1.1`,
or an interface, like `eth0`. If `DataPathAddr` is unspecified, the same address as `AdvertiseAddr`
is used.
The `DataPathAddr` specifies the address that global scope network drivers will publish towards other
nodes in order to reach the containers running on this node. Using this parameter it is possible to
separate the container data traffic from the management traffic of the cluster.
'
type: string
RemoteAddrs:
description: Addresses of manager nodes already participating in the swarm.
type: string
JoinToken:
description: Secret token for joining this swarm.
type: string
example:
ListenAddr: 0.0.0.0:2377
AdvertiseAddr: 192.168.1.1:2377
RemoteAddrs:
- node1:2377
JoinToken: SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2
text/plain:
schema:
type: object
properties:
ListenAddr:
description: Listen address used for inter-manager communication if the node gets promoted to manager, as well as determining the networking interface used for the VXLAN Tunnel Endpoint (VTEP).
type: string
AdvertiseAddr:
description: Externally reachable address advertised to other nodes. This can either be an address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port number, like `eth0:4567`. If the port number is omitted, the port number from the listen address is used. If `AdvertiseAddr` is not specified, it will be automatically detected when possible.
type: string
DataPathAddr:
description: 'Address or interface to use for data path traffic (format: `<ip|interface>`), for example, `192.168.1.1`,
or an interface, like `eth0`. If `DataPathAddr` is unspecified, the same address as `AdvertiseAddr`
is used.
The `DataPathAddr` specifies the address that global scope network drivers will publish towards other
nodes in order to reach the containers running on this node. Using this parameter it is possible to
separate the container data traffic from the management traffic of the cluster.
'
type: string
RemoteAddrs:
description: Addresses of manager nodes already participating in the swarm.
type: string
JoinToken:
description: Secret token for joining this swarm.
type: string
example:
ListenAddr: 0.0.0.0:2377
AdvertiseAddr: 192.168.1.1:2377
RemoteAddrs:
- node1:2377
JoinToken: SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2
required: true
/swarm/leave:
post:
summary: Leave a swarm
operationId: SwarmLeave
responses:
200:
description: no error
500:
description: server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
text/plain:
schema:
$ref: '#/components/schemas/ErrorResponse'
503:
description: node is not part of a swarm
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
text/plain:
schema:
$ref: '#/components/schemas/ErrorResponse'
parameters:
- name: force
description: Force leave swarm, even if this is the last manager or that it will break the cluster.
in: query
schema:
type: boolean
default: false
tags:
- Swarm
/swarm/update:
post:
summary: Update a swarm
operationId: SwarmUpdate
responses:
200:
description: no error
400:
description: bad parameter
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
text/plain:
schema:
$ref: '#/components/schemas/ErrorResponse'
500:
description: server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
text/plain:
schema:
$ref: '#/components/schemas/ErrorResponse'
503:
description: node is not part of a swarm
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
text/plain:
schema:
$ref: '#/components/schemas/ErrorResponse'
parameters:
- name: version
in: query
description: The version number of the swarm object being updated. This is required to avoid conflicting writes.
required: true
schema:
type: integer
format: int64
- name: rotateWorkerToken
in: query
description: Rotate the worker join token.
schema:
type: boolean
default: false
- name: rotateManagerToken
in: query
description: Rotate the manager join token.
schema:
type: boolean
default: false
- name: rotateManagerUnlockKey
in: query
description: Rotate the manager unlock key.
schema:
type: boolean
default: false
tags:
- Swarm
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SwarmSpec'
text/plain:
schema:
$ref: '#/components/schemas/SwarmSpec'
required: true
/swarm/unlockkey:
get:
summary: Get the unlock key
operationId: SwarmUnlockkey
responses:
200:
description: no error
content:
application/json:
schema:
type: object
properties:
UnlockKey:
description: The swarm's unlock key.
type: string
example:
UnlockKey: SWMKEY-1-7c37Cc8654o6p38HnroywCi19pllOnGtbdZEgtKxZu8
text/plain:
schema:
type: object
properties:
UnlockKey:
description: The swarm's unlock key.
type: string
example:
UnlockKey: SWMKEY-1-7c37Cc8654o6p38HnroywCi19pllOnGtbdZEgtKxZu8
500:
description: server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
text/plain:
schema:
$ref: '#/components/schemas/ErrorResponse'
503:
description: node is not part of a swarm
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
text/plain:
schema:
$ref: '#/components/schemas/ErrorResponse'
tags:
- Swarm
/swarm/unlock:
post:
summary: Unlock a locked manager
operationId: SwarmUnlock
responses:
200:
description: no error
500:
description: server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
503:
description: node is not part of a swarm
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
tags:
- Swarm
requestBody:
content:
application/json:
schema:
type: object
properties:
UnlockKey:
description: The swarm's unlock key.
type: string
example:
UnlockKey: SWMKEY-1-7c37Cc8654o6p38HnroywCi19pllOnGtbdZEgtKxZu8
required: true
components:
schemas:
JoinTokens:
description: 'JoinTokens contains the tokens workers and managers need to join the swarm.
'
type: object
properties:
Worker:
description: 'The token workers can use to join the swarm.
'
type: string
example: SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx
Manager:
description: 'The token managers can use to join the swarm.
'
type: string
example: SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2
TLSInfo:
description: Information about the issuer of leaf TLS certificates and the trusted root CA certificate
type: object
properties:
TrustRoot:
description: The root CA certificate(s) that are used to validate leaf TLS certificates
type: string
CertIssuerSubject:
description: The base64-url-safe-encoded raw subject bytes of the issuer
type: string
CertIssuerPublicKey:
description: The base64-url-safe-encoded raw public key bytes of the issuer
type: string
example:
TrustRoot: '-----BEGIN CERTIFICATE-----
MIIBajCCARCgAwIBAgIUbYqrLSOSQHoxD8CwG6Bi2PJi9c8wCgYIKoZIzj0EAwIw
EzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNDI0MjE0MzAwWhcNMzcwNDE5MjE0
MzAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH
A0IABJk/VyMPYdaqDXJb/VXh5n/1Yuv7iNrxV3Qb3l06XD46seovcDWs3IZNV1lf
3Skyr0ofcchipoiHkXBODojJydSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB
Af8EBTADAQH/MB0GA1UdDgQWBBRUXxuRcnFjDfR/RIAUQab8ZV/n4jAKBggqhkjO
PQQDAgNIADBFAiAy+JTe6Uc3KyLCMiqGl2GyWGQqQDEcO3/YG36x7om65AIhAJvz
pxv6zFeVEkAEEkqIYi0omA9+CjanB/6Bz4n1uw8H
-----END CERTIFICATE-----
'
CertIssuerSubject: MBMxETAPBgNVBAMTCHN3YXJtLWNh
CertIssuerPublicKey: MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmT9XIw9h1qoNclv9VeHmf/Vi6/uI2vFXdBveXTpcPjqx6i9wNazchk1XWV/dKTKvSh9xyGKmiIeRcE4OiMnJ1A==
SwarmSpec:
description: User modifiable swarm configuration.
type: object
properties:
Name:
description: Name of the swarm.
type: string
example: default
Labels:
description: User-defined key/value metadata.
type: object
additionalProperties:
type: string
example:
com.example.corp.type: production
com.example.corp.department: engineering
Orchestration:
description: Orchestration configuration.
type:
- object
- 'null'
properties:
TaskHistoryRetentionLimit:
description: The number of historic tasks to keep per instance or node. If negative, never remove completed or failed tasks.
type: integer
format: int64
example: 10
Raft:
description: Raft configuration.
type: object
properties:
SnapshotInterval:
description: The number of log entries between snapshots.
type: integer
format: uint64
example: 10000
KeepOldSnapshots:
description: The number of snapshots to keep beyond the current snapshot.
type: integer
format: uint64
LogEntriesForSlowFollowers:
description: The number of log entries to keep around to sync up slow followers after a snapshot is created.
type: integer
format: uint64
example: 500
ElectionTick:
description: 'The number of ticks that a follower will wait for a message from the leader before becoming a candidate and starting an election. `ElectionTick` must be greater than `HeartbeatTick`.
A tick currently defaults to one second, so these translate directly to seconds currently, but this is NOT guaranteed.
'
type: integer
example: 3
HeartbeatTick:
description: 'The number of ticks between heartbeats. Every HeartbeatTick ticks, the leader will send a heartbeat to the followers.
A tick currently defaults to one second, so these translate directly to seconds currently, but this is NOT guaranteed.
'
type: integer
example: 1
Dispatcher:
description: Dispatcher configuration.
type:
- object
- 'null'
properties:
HeartbeatPeriod:
description: The delay for an agent to send a heartbeat to the dispatcher.
type: integer
format: int64
example: 5000000000
CAConfig:
description: CA configuration.
type:
- object
- 'null'
properties:
NodeCertExpiry:
description: The duration node certificates are issued for.
type: integer
format: int64
example: 7776000000000000
ExternalCAs:
description: Configuration for forwarding signing requests to an external certificate authority.
type: array
items:
type: object
properties:
Protocol:
description: Protocol for communication with the external CA (currently only `cfssl` is supported).
type: string
enum:
- cfssl
default: cfssl
URL:
description: URL where certificate signing requests should be sent.
type: string
Options:
description: An object with key/value pairs that are interpreted as protocol-specific options for the external CA driver.
type: object
additionalProperties:
type: string
CACert:
description: The root CA certificate (in PEM format) this external CA uses to issue TLS certificates (assumed to be to the current swarm root CA certificate if not provided).
type: string
SigningCACert:
description: The desired signing CA certificate for all swarm node TLS leaf certificates, in PEM format.
type: string
SigningCAKey:
description: The desired signing CA key for all swarm node TLS leaf certificates, in PEM format.
type: string
ForceRotate:
description: An integer whose purpose is to force swarm to generate a new signing CA certificate and key, if none have been specified in `SigningCACert` and `SigningCAKey`
format: uint64
type: integer
EncryptionConfig:
description: Parameters related to encryption-at-rest.
type: object
properties:
AutoLockManagers:
description: If set, generate a key and use it to lock data stored on the managers.
type: boolean
example: false
TaskDefaults:
description: Defaults for creating tasks in this cluster.
type: object
properties:
LogDriver:
description: 'The log driver to use for tasks created in the orchestrator if
unspecified by a service.
Updating this value only affects new tasks. Existing tasks continue
to use their previously configured log driver until recreated.
'
type: object
properties:
Name:
description: 'The log driver to use as a default for new tasks.
'
type: string
example: json-file
Options:
description: 'Driver-specific options for the selectd log driver, specified
as key/value pairs.
'
type: object
additionalProperties:
type: string
example:
max-file: '10'
max-size: 100m
ObjectVersion:
description: 'The version number of the object such as node, service, etc. This is needed to avoid conflicting writes.
The client must send the version number along with the modified specification when updating these objects.
This approach ensures safe concurrency and determinism in that the change on the object
may not be applied if the version number has changed from the last read. In other words,
if two update requests specify the same base version, only one of the requests can succeed.
As a result, two separate update requests that happen at the same time will not
unintentionally overwrite each other.
'
type: object
properties:
Index:
type: integer
format: uint64
example: 373531
ClusterInfo:
description: 'ClusterInfo represents information about the swarm as is returned by the
"/info" endpoint. Join-tokens are not included.
'
type:
- object
- 'null'
properties:
ID:
description: The ID of the swarm.
type: string
example: abajmipo7b4xz5ip2nrla6b11
Version:
$ref: '#/components/schemas/ObjectVersion'
CreatedAt:
description: 'Date and time at which the swarm was initialised in
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
'
type: string
format: dateTime
example: '2016-08-18T10:44:24.496525531Z'
UpdatedAt:
description: 'Date and time at which the swarm was last updated in
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
'
type: string
format: dateTime
example: '2017-08-09T07:09:37.632105588Z'
Spec:
$ref: '#/components/schemas/SwarmSpec'
TLSInfo:
$ref: '#/components/schemas/TLSInfo'
RootRotationInProgress:
description: Whether there is currently a root CA rotation in progress for the swarm
type: boolean
example: false
ErrorResponse:
description: Represents an error.
type: object
required:
- message
properties:
message:
description: The error message.
type: string
example:
message: Something went wrong.
Swarm:
type: object
allOf:
- $ref: '#/components/schemas/ClusterInfo'
- type: object
properties:
JoinTokens:
$ref: '#/components/schemas/JoinTokens'