v1

latestOpenAPI 3.0.02026-07-1410578280.2 KB
Task

List tasks

get/tasks

Query parameters

filtersstring

A JSON encoded value of the filters (a map[string][]string) to process on the tasks list. Available filters:

  • desired-state=(running | shutdown | accepted)
  • id=<task id>
  • label=key or label="key=value"
  • name=<task name>
  • node=<node id or name>
  • service=<service name>

Response

no error

CreatedAtstring dateTime
DesiredState'new' | 'allocated' | 'pending' | 'assigned' | 'accepted' | 'preparing' | 'ready' | 'starting' | 'running' | 'complete' | 'shutdown' | 'failed' | 'rejected'
IDstring

The ID of the task.

Labelsobject

User-defined key/value metadata.

Namestring

Name of the task.

NodeIDstring

The ID of the node that this task is on.

ServiceIDstring

The ID of the service this task is part of.

Slotinteger
UpdatedAtstring dateTime

Example response

[
  {
    "CreatedAt": "2016-06-07T21:07:31.171892745Z",
    "DesiredState": "running",
    "ID": "0kzzo1i0y4jz6027t0k7aezc7",
    "NetworksAttachments": [
      {
        "Addresses": [
          "10.255.0.10/16"
        ],
        "Network": {
          "CreatedAt": "2016-06-07T20:31:11.912919752Z",
          "DriverState": {
            "Name": "overlay",
            "Options": {
              "com.docker.network.driver.overlay.vxlanid_list": "256"
            }
          },
          "ID": "4qvuz4ko70xaltuqbt8956gd1",
          "IPAMOptions": {
            "Configs": [
              {
                "Gateway": "10.255.0.1",
                "Subnet": "10.255.0.0/16"
              }
            ],
            "Driver": {
              "Name": "default"
            }
          },
          "Spec": {
            "DriverConfiguration": {},
            "IPAMOptions": {
              "Configs": [
                {
                  "Gateway": "10.255.0.1",
                  "Subnet": "10.255.0.0/16"
                }
              ],
              "Driver": {}
            },
            "Labels": {
              "com.docker.swarm.internal": "true"
            },
            "Name": "ingress"
          },
          "UpdatedAt": "2016-06-07T21:07:29.955277358Z",
          "Version": {
            "Index": 18
          }
        }
      }
    ],
    "NodeID": "60gvrl6tm78dmak4yl7srz94v",
    "ServiceID": "9mnpnzenvg8p8tdbtq4wvbkcz",
    "Slot": 1,
    "Spec": {
      "ContainerSpec": {
        "Image": "redis"
      },
      "Placement": {},
      "Resources": {
        "Limits": {},
        "Reservations": {}
      },
      "RestartPolicy": {
        "Condition": "any",
        "MaxAttempts": 0
      }
    },
    "Status": {
      "ContainerStatus": {
        "ContainerID": "e5d62702a1b48d01c3e02ca1e0212a250801fa8d67caca0b6f35919ebc12f035",
        "PID": 677
      },
      "Message": "started",
      "State": "running",
      "Timestamp": "2016-06-07T21:07:31.290032978Z"
    },
    "UpdatedAt": "2016-06-07T21:07:31.376370513Z",
    "Version": {
      "Index": 71
    }
  },
  {
    "CreatedAt": "2016-06-07T21:07:30.019104782Z",
    "DesiredState": "shutdown",
    "ID": "1yljwbmlr8er2waf8orvqpwms",
    "Name": "hopeful_cori",
    "NetworksAttachments": [
      {
        "Addresses": [
          "10.255.0.5/16"
        ],
        "Network": {
          "CreatedAt": "2016-06-07T20:31:11.912919752Z",
          "DriverState": {
            "Name": "overlay",
            "Options": {
              "com.docker.network.driver.overlay.vxlanid_list": "256"
            }
          },
          "ID": "4qvuz4ko70xaltuqbt8956gd1",
          "IPAMOptions": {
            "Configs": [
              {
                "Gateway": "10.255.0.1",
                "Subnet": "10.255.0.0/16"
              }
            ],
            "Driver": {
              "Name": "default"
            }
          },
          "Spec": {
            "DriverConfiguration": {},
            "IPAMOptions": {
              "Configs": [
                {
                  "Gateway": "10.255.0.1",
                  "Subnet": "10.255.0.0/16"
                }
              ],
              "Driver": {}
            },
            "Labels": {
              "com.docker.swarm.internal": "true"
            },
            "Name": "ingress"
          },
          "UpdatedAt": "2016-06-07T21:07:29.955277358Z",
          "Version": {
            "Index": 18
          }
        }
      }
    ],
    "NodeID": "60gvrl6tm78dmak4yl7srz94v",
    "ServiceID": "9mnpnzenvg8p8tdbtq4wvbkcz",
    "Slot": 1,
    "Spec": {
      "ContainerSpec": {
        "Image": "redis"
      },
      "Placement": {},
      "Resources": {
        "Limits": {},
        "Reservations": {}
      },
      "RestartPolicy": {
        "Condition": "any",
        "MaxAttempts": 0
      }
    },
    "Status": {
      "ContainerStatus": {
        "ContainerID": "1cf8d63d18e79668b0004a4be4c6ee58cddfad2dae29506d8781581d0688a213"
      },
      "Message": "shutdown",
      "State": "shutdown",
      "Timestamp": "2016-06-07T21:07:30.202183143Z"
    },
    "UpdatedAt": "2016-06-07T21:07:30.231958098Z",
    "Version": {
      "Index": 30
    }
  }
]