List services Run in API Explorer
Query parameters
-
A JSON encoded value of the filters (a
map[string][]string
) to process on the services list.Available filters:
id=<service id>
label=<service label>
mode=["replicated"|"global"]
name=<service name>
-
Include service status, with count of running and desired tasks.
Responses
-
no error
Hide response attributes Show response attributes object
-
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.
-
User modifiable configuration for a service.
Hide Spec attributes Show Spec attributes object
-
Name of the service.
-
User-defined key/value metadata.
-
User modifiable task configuration.
Hide TaskTemplate attributes Show TaskTemplate attributes object
-
Plugin spec for the service. (Experimental release only.)
Note: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually exclusive. PluginSpec is only used when the Runtime field is set to
plugin
. NetworkAttachmentSpec is used when the Runtime field is set toattachment
.Hide PluginSpec attributes Show PluginSpec attributes object
-
The name or 'alias' to use for the plugin.
-
The plugin image reference to use.
-
Disable the plugin once scheduled.
-
Describes a permission the user has to accept upon installing the plugin.
-
-
Container spec for the service.
Note: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually exclusive. PluginSpec is only used when the Runtime field is set to
plugin
. NetworkAttachmentSpec is used when the Runtime field is set toattachment
.Hide ContainerSpec attributes Show ContainerSpec attributes object
-
The image name to use for the container
-
User-defined key/value data.
-
The command to be run in the image.
-
Arguments to the command.
-
The hostname to use for the container, as a valid RFC 1123 hostname.
-
A list of environment variables in the form
VAR=value
. -
The working directory for commands to run in.
-
The user inside the container.
-
A list of additional groups that the container process will run as.
-
Security options for the container
Hide Privileges attributes Show Privileges attributes object
-
CredentialSpec for managed service account (Windows only)
Hide CredentialSpec attributes Show CredentialSpec attributes object
-
Load credential spec from a Swarm Config with the given ID. The specified config must also be present in the Configs field with the Runtime property set.
Note:
CredentialSpec.File
,CredentialSpec.Registry
, andCredentialSpec.Config
are mutually exclusive. -
Load credential spec from this file. The file is read by the daemon, and must be present in the
CredentialSpecs
subdirectory in the docker data directory, which defaults toC:\ProgramData\Docker\
on Windows.For example, specifying
spec.json
loadsC:\ProgramData\Docker\CredentialSpecs\spec.json
.Note:
CredentialSpec.File
,CredentialSpec.Registry
, andCredentialSpec.Config
are mutually exclusive. -
Load credential spec from this value in the Windows registry. The specified registry value must be located in:
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Containers\CredentialSpecs
Note:
CredentialSpec.File
,CredentialSpec.Registry
, andCredentialSpec.Config
are mutually exclusive.
-
-
SELinux labels of the container
-
Options for configuring seccomp on the container
-
Options for configuring AppArmor on the container
-
Configuration of the no_new_privs bit in the container
-
-
Whether a pseudo-TTY should be allocated.
-
Open
stdin
-
Mount the container's root filesystem as read only.
-
Specification for mounts to be added to containers created as part of the service.
Hide Mounts attributes Show Mounts attributes object
-
Container path.
-
Mount source (e.g. a volume name, a host path).
-
The mount type. Available types:
bind
Mounts a file or directory from the host into the container. Must exist prior to creating the container.volume
Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are not removed when the container is removed.image
Mounts an image.tmpfs
Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.npipe
Mounts a named pipe from the host into the container. Must exist prior to creating the container.cluster
a Swarm cluster volume
Values are
bind
,volume
,image
,tmpfs
,npipe
, orcluster
. -
Whether the mount should be read-only.
-
The consistency requirement for the mount:
default
,consistent
,cached
, ordelegated
. -
Optional configuration for the
bind
type.Hide BindOptions attributes Show BindOptions attributes object
-
A propagation mode with the value
[r]private
,[r]shared
, or[r]slave
.Values are
private
,rprivate
,shared
,rshared
,slave
, orrslave
. -
Disable recursive bind mount.
Default value is
false
. -
Create mount point on host if missing
Default value is
false
. -
Make the mount non-recursively read-only, but still leave the mount recursive (unless NonRecursive is set to
true
in conjunction).Added in v1.44, before that version all read-only mounts were non-recursive by default. To match the previous behaviour this will default to
true
for clients on versions prior to v1.44.Default value is
false
. -
Raise an error if the mount cannot be made recursively read-only.
Default value is
false
.
-
-
Optional configuration for the
volume
type.Hide VolumeOptions attributes Show VolumeOptions attributes object
-
Populate volume with data from the target.
Default value is
false
. -
User-defined key/value metadata.
-
Map of driver specific options
-
Source path inside the volume. Must be relative without any back traversals.
-
-
Optional configuration for the
image
type. -
Optional configuration for the
tmpfs
type.Hide TmpfsOptions attributes Show TmpfsOptions attributes object
-
The size for the tmpfs mount in bytes.
-
The permission mode for the tmpfs mount in an integer.
-
The options to be passed to the tmpfs mount. An array of arrays. Flag options should be provided as 1-length arrays. Other types should be provided as as 2-length arrays, where the first item is the key and the second the value.
At least
1
but not more than2
elements.
-
-
-
Signal to stop the container.
-
Amount of time to wait for the container to terminate before forcefully killing it.
-
A test to perform to check that the container is healthy.
Hide HealthCheck attributes Show HealthCheck attributes object
-
The test to perform. Possible values are:
[]
inherit healthcheck from image or parent image["NONE"]
disable healthcheck["CMD", args...]
exec arguments directly["CMD-SHELL", command]
run command with system's default shell
-
The time to wait between checks in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means inherit.
-
The time to wait before considering the check to have hung. It should be 0 or at least 1000000 (1 ms). 0 means inherit.
-
The number of consecutive failures needed to consider a container as unhealthy. 0 means inherit.
-
Start period for the container to initialize before starting health-retries countdown in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means inherit.
-
The time to wait between checks in nanoseconds during the start period. It should be 0 or at least 1000000 (1 ms). 0 means inherit.
-
-
A list of hostname/IP mappings to add to the container's
hosts
file. The format of extra hosts is specified in the hosts(5) man page:IP_address canonical_hostname [aliases...]
-
Specification for DNS related configurations in resolver configuration file (
resolv.conf
). -
Secrets contains references to zero or more secrets that will be exposed to the service.
Hide Secrets attributes Show Secrets attributes object
-
File represents a specific target that is backed by a file.
-
SecretID represents the ID of the specific secret that we're referencing.
-
SecretName is the name of the secret that this references, but this is just provided for lookup/display purposes. The secret in the reference will be identified by its ID.
-
-
An integer value containing the score given to the container in order to tune OOM killer preferences.
-
Configs contains references to zero or more configs that will be exposed to the service.
Hide Configs attributes Show Configs attributes object
-
File represents a specific target that is backed by a file.
Note:
Configs.File
andConfigs.Runtime
are mutually exclusive -
Runtime represents a target that is not mounted into the container but is used by the task
Note:
Configs.File
andConfigs.Runtime
are mutually exclusive -
ConfigID represents the ID of the specific config that we're referencing.
-
ConfigName is the name of the config that this references, but this is just provided for lookup/display purposes. The config in the reference will be identified by its ID.
-
-
Isolation technology of the containers running the service. (Windows only)
Values are
default
,process
,hyperv
, or.
-
Run an init inside the container that forwards signals and reaps processes. This field is omitted if empty, and the default (as configured on the daemon) is used.
-
Set kernel namedspaced parameters (sysctls) in the container. The Sysctls option on services accepts the same sysctls as the are supported on containers. Note that while the same sysctls are supported, no guarantees or checks are made about their suitability for a clustered environment, and it's up to the user to determine whether a given sysctl will work properly in a Service.
-
A list of kernel capabilities to add to the default set for the container.
-
A list of kernel capabilities to drop from the default set for the container.
-
A list of resource limits to set in the container. For example:
{"Name": "nofile", "Soft": 1024, "Hard": 2048}
"
-
-
Read-only spec type for non-swarm containers attached to swarm overlay networks.
Note: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually exclusive. PluginSpec is only used when the Runtime field is set to
plugin
. NetworkAttachmentSpec is used when the Runtime field is set toattachment
. -
Resource requirements which apply to each individual container created as part of the service.
Hide Resources attributes Show Resources attributes object
-
Define resources limits.
-
An object describing the resources which can be advertised by a node and requested by a task.
Hide Reservations attributes Show Reservations attributes object
-
User-defined resources can be either Integer resources (e.g,
SSD=3
) or String resources (e.g,GPU=UUID1
).Hide GenericResources attributes Show GenericResources attributes object
-
-
Specification for the restart policy which applies to containers created as part of this service.
Hide RestartPolicy attributes Show RestartPolicy attributes object
-
Condition for restart.
Values are
none
,on-failure
, orany
. -
Delay between restart attempts.
-
Maximum attempts to restart a given container before giving up (default value is 0, which is ignored).
Default value is
0
. -
Windows is the time window used to evaluate the restart policy (default value is 0, which is unbounded).
Default value is
0
.
-
-
Hide Placement attributes Show Placement attributes object
-
An array of constraint expressions to limit the set of nodes where a task can be scheduled. Constraint expressions can either use a match (
==
) or exclude (!=
) rule. Multiple constraints find nodes that satisfy every expression (AND match). Constraints can match node or Docker Engine labels as follows:node attribute matches example node.id
Node ID node.id==2ivku8v2gvtg4
node.hostname
Node hostname node.hostname!=node-2
node.role
Node role ( manager
/worker
)node.role==manager
node.platform.os
Node operating system node.platform.os==windows
node.platform.arch
Node architecture node.platform.arch==x86_64
node.labels
User-defined node labels node.labels.security==high
engine.labels
Docker Engine's labels engine.labels.operatingsystem==ubuntu-24.04
engine.labels
apply to Docker Engine labels like operating system, drivers, etc. Swarm administrators addnode.labels
for operational purposes by using thenode update endpoint
. -
Preferences provide a way to make the scheduler aware of factors such as topology. They are provided in order from highest to lowest precedence.
-
Maximum number of replicas for per node (default value is 0, which is unlimited)
Default value is
0
. -
Platforms stores all the platforms that the service's image can run on. This field is used in the platform filter for scheduling. If empty, then the platform filter is off, meaning there are no scheduling restrictions.
Platform represents the platform (Arch/OS).
-
-
A counter that triggers an update even if no relevant parameters have been changed.
-
Runtime is the type of runtime specified for the task executor.
-
Specifies which networks the service should attach to.
Specifies how a service should be attached to a particular network.
Hide Networks attributes Show Networks attributes object
-
The target network for attachment. Must be a network name or ID.
-
Discoverable alternate names for the service on this network.
-
Driver attachment options for the network target.
-
-
Specifies the log driver to use for tasks created from this spec. If not present, the default one for the swarm will be used, finally falling back to the engine default if not specified.
-
-
Scheduling mode for the service.
Hide Mode attributes Show Mode attributes object
-
The mode used for services with a finite number of tasks that run to a completed state.
Hide ReplicatedJob attributes Show ReplicatedJob attributes object
-
The mode used for services which run a task to the completed state on each valid node.
-
Specification for the update strategy of the service.
Hide UpdateConfig attributes Show UpdateConfig attributes object
-
Maximum number of tasks to be updated in one iteration (0 means unlimited parallelism).
-
Amount of time between updates, in nanoseconds.
-
Action to take if an updated task fails to run, or stops running during the update.
Values are
continue
,pause
, orrollback
. -
Amount of time to monitor each updated task for failures, in nanoseconds.
-
The fraction of tasks that may fail during an update before the failure action is invoked, specified as a floating point number between 0 and 1.
Default value is
0
. -
The order of operations when rolling out an updated task. Either the old task is shut down before the new task is started, or the new task is started before the old task is shut down.
Values are
stop-first
orstart-first
.
-
-
Specification for the rollback strategy of the service.
Hide RollbackConfig attributes Show RollbackConfig attributes object
-
Maximum number of tasks to be rolled back in one iteration (0 means unlimited parallelism).
-
Amount of time between rollback iterations, in nanoseconds.
-
Action to take if an rolled back task fails to run, or stops running during the rollback.
Values are
continue
orpause
. -
Amount of time to monitor each rolled back task for failures, in nanoseconds.
-
The fraction of tasks that may fail during a rollback before the failure action is invoked, specified as a floating point number between 0 and 1.
Default value is
0
. -
The order of operations when rolling back a task. Either the old task is shut down before the new task is started, or the new task is started before the old task is shut down.
Values are
stop-first
orstart-first
.
-
-
Specifies which networks the service should attach to.
Deprecated: This field is deprecated since v1.44. The Networks field in TaskSpec should be used instead.
Specifies how a service should be attached to a particular network.
Hide Networks attributes Show Networks attributes object
-
The target network for attachment. Must be a network name or ID.
-
Discoverable alternate names for the service on this network.
-
Driver attachment options for the network target.
-
-
Properties that can be configured to access and load balance a service.
Hide EndpointSpec attributes Show EndpointSpec attributes object
-
The mode of resolution to use for internal load balancing between tasks.
Values are
vip
ordnsrr
. Default value isvip
. -
List of exposed ports that this service is accessible on from the outside. Ports can only be provided if
vip
resolution mode is used.Hide Ports attributes Show Ports attributes object
-
Values are
tcp
,udp
, orsctp
. -
The port inside the container.
-
The port on the swarm hosts.
-
The mode in which port is published.
- "ingress" makes the target port accessible on every node, regardless of whether there is a task for the service running on that node or not.
- "host" bypasses the routing mesh and publish the port directly on the swarm node where that service is running.
Values are
ingress
orhost
. Default value isingress
.
-
-
-
Hide Endpoint attributes Show Endpoint attributes object
-
Properties that can be configured to access and load balance a service.
Hide Spec attributes Show Spec attributes object
-
The mode of resolution to use for internal load balancing between tasks.
Values are
vip
ordnsrr
. Default value isvip
. -
List of exposed ports that this service is accessible on from the outside. Ports can only be provided if
vip
resolution mode is used.Hide Ports attributes Show Ports attributes object
-
Values are
tcp
,udp
, orsctp
. -
The port inside the container.
-
The port on the swarm hosts.
-
The mode in which port is published.
- "ingress" makes the target port accessible on every node, regardless of whether there is a task for the service running on that node or not.
- "host" bypasses the routing mesh and publish the port directly on the swarm node where that service is running.
Values are
ingress
orhost
. Default value isingress
.
-
-
Hide Ports attributes Show Ports attributes object
-
Values are
tcp
,udp
, orsctp
. -
The port inside the container.
-
The port on the swarm hosts.
-
The mode in which port is published.
- "ingress" makes the target port accessible on every node, regardless of whether there is a task for the service running on that node or not.
- "host" bypasses the routing mesh and publish the port directly on the swarm node where that service is running.
Values are
ingress
orhost
. Default value isingress
.
-
-
The status of a service update.
-
The status of the service's tasks. Provided only when requested as part of a ServiceList operation.
Hide ServiceStatus attributes Show ServiceStatus attributes object
-
The number of tasks for the service currently in the Running state.
-
The number of tasks for the service desired to be running. For replicated services, this is the replica count from the service spec. For global services, this is computed by taking count of all tasks for the service with a Desired State other than Shutdown.
-
The number of tasks for a job that are in the Completed state. This field must be cross-referenced with the service type, as the value of 0 may mean the service is not in a job mode, or it may mean the job-mode service has no tasks yet Completed.
-
-
The status of the service when it is in one of ReplicatedJob or GlobalJob modes. Absent on Replicated and Global mode services. The JobIteration is an ObjectVersion, but unlike the Service's version, does not need to be sent with an update request.
Hide JobStatus attributes Show JobStatus attributes object
-
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.
-
The last time, as observed by the server, that this job was started.
-
-
server error
-
node is not part of a swarm
curl \
--request GET 'http://api.example.com/v1.49/services'
[
{
"ID": "9mnpnzenvg8p8tdbtq4wvbkcz",
"Spec": {
"Mode": {
"Replicated": {
"Replicas": 1
}
},
"Name": "hopeful_cori",
"EndpointSpec": {
"Mode": "vip",
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 6379,
"PublishedPort": 30001
}
]
},
"TaskTemplate": {
"Placement": {},
"Resources": {
"Limits": {},
"Reservations": {}
},
"ForceUpdate": 0,
"ContainerSpec": {
"Image": "redis"
},
"RestartPolicy": {
"Condition": "any",
"MaxAttempts": 0
}
},
"UpdateConfig": {
"Delay": 1000000000,
"Monitor": 15000000000,
"Parallelism": 1,
"FailureAction": "pause",
"MaxFailureRatio": 0.15
},
"RollbackConfig": {
"Delay": 1000000000,
"Monitor": 15000000000,
"Parallelism": 1,
"FailureAction": "pause",
"MaxFailureRatio": 0.15
}
},
"Version": {
"Index": 19
},
"Endpoint": {
"Spec": {
"Mode": "vip",
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 6379,
"PublishedPort": 30001
}
]
},
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 6379,
"PublishedPort": 30001
}
],
"VirtualIPs": [
{
"Addr": "10.255.0.2/16",
"NetworkID": "4qvuz4ko70xaltuqbt8956gd1"
},
{
"Addr": "10.255.0.3/16",
"NetworkID": "4qvuz4ko70xaltuqbt8956gd1"
}
]
},
"CreatedAt": "2016-06-07T21:05:51.880065305Z",
"UpdatedAt": "2016-06-07T21:07:29.962229872Z"
}
]
{
"message": "Something went wrong."
}
{
"message": "Something went wrong."
}
{
"message": "Something went wrong."
}
{
"message": "Something went wrong."
}