---
title: "GET /tasks"
method: GET
path: "/tasks"
---

# GET /tasks

`GET /tasks`

List tasks

## Query parameters

- `filters` string

## Response `200`

The request has succeeded.

- Task[]
  - `ID` string — The ID of the task.
  - `Version` ObjectVersion — 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.
    - `Index` integer
  - `CreatedAt` string, date-time
  - `UpdatedAt` string, date-time
  - `Name` string — Name of the task.
  - `Labels` object — User-defined key/value metadata.
  - `Spec` TaskSpec — User modifiable task configuration.
    - `PluginSpec` object — Plugin spec for the service. *(Experimental release only.)* <p><br /></p> > **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 to `attachment`.
      - `Name` string
      - `Remote` string
      - `Disabled` boolean
      - `PluginPrivilege` PluginPrivilege[]
        - `Name` string
        - `Description` string
        - `Value` string[]
    - `ContainerSpec` object — Container spec for the service. <p><br /></p> > **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 to `attachment`.
      - `Image` string
      - `Labels` object
      - `Command` string[]
      - `Args` string[]
      - `Hostname` string
      - `Env` string[]
      - `Dir` string
      - `User` string
      - `Groups` string[]
      - `Privileges` object
        - `CredentialSpec` object
          - `Config` string
          - `File` string
          - `Registry` string
        - `SELinuxContext` object
          - `Disable` boolean
          - `User` string
          - `Role` string
          - `Type` string
          - `Level` string
        - `Seccomp` object
          - `Mode` 'default' | 'unconfined' | 'custom'
          - `Profile` string
        - `AppArmor` object
          - `Mode` 'default' | 'disabled'
        - `NoNewPrivileges` boolean
      - `TTY` boolean
      - `OpenStdin` boolean
      - `ReadOnly` boolean
      - `Mounts` Mount[]
        - `Target` string — Container path.
        - `Source` string — Mount source (e.g. a volume name, a host path). The source cannot be specified when using `Type=tmpfs`. For `Type=bind`, the source path must either exist, or the `CreateMountpoint` must be set to `true` to create the source path on the host if missing. For `Type=npipe`, the pipe must exist prior to creating the container.
        - `Type` 'bind' | 'cluster' | 'image' | 'npipe' | 'tmpfs' | 'volume' — The mount type. Available types: - `bind` a mount of a file or directory from the host into the container. - `cluster` a Swarm cluster volume. - `image` an OCI image. - `npipe` a named pipe from the host into the container. - `tmpfs` a `tmpfs`. - `volume` a docker volume with the given `Name`.
        - `ReadOnly` boolean — Whether the mount should be read-only.
        - `Consistency` string — The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`.
        - `BindOptions` object — Optional configuration for the `bind` type.
          - `Propagation` 'private' | 'rprivate' | 'shared' | 'rshared' | 'slave' | 'rslave'
          - `NonRecursive` boolean
          - `CreateMountpoint` boolean
          - `ReadOnlyNonRecursive` boolean
          - `ReadOnlyForceRecursive` boolean
        - `VolumeOptions` object — Optional configuration for the `volume` type.
          - `NoCopy` boolean
          - `Labels` object
          - `DriverConfig` object
            - `Name` string
            - `Options` object
          - `Subpath` string
        - `ImageOptions` object — Optional configuration for the `image` type.
          - `Subpath` string
        - `TmpfsOptions` object — Optional configuration for the `tmpfs` type.
          - `SizeBytes` integer
          - `Mode` integer
          - `Options` array[]
            - string[]
      - `StopSignal` string
      - `StopGracePeriod` integer
      - `HealthCheck` HealthConfig — A test to perform to check that the container is healthy. Healthcheck commands should be side-effect free.
        - `Test` string[] — 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 A non-zero exit code indicates a failed healthcheck: - `0` healthy - `1` unhealthy - `2` reserved (treated as unhealthy) - other values: error running probe
        - `Interval` integer — The time to wait between checks in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means inherit.
        - `Timeout` integer — The time to wait before considering the check to have hung. It should be 0 or at least 1000000 (1 ms). 0 means inherit. If the health check command does not complete within this timeout, the check is considered failed and the health check process is forcibly terminated without a graceful shutdown.
        - `Retries` integer — The number of consecutive failures needed to consider a container as unhealthy. 0 means inherit.
        - `StartPeriod` integer — 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.
        - `StartInterval` integer — 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.
      - `Hosts` string[]
      - `DNSConfig` object
        - `Nameservers` string[]
        - `Search` string[]
        - `Options` string[]
      - `Secrets` object[]
        - `File` object
          - `Name` string
          - `UID` string
          - `GID` string
          - `Mode` integer
        - `SecretID` string
        - `SecretName` string
      - `OomScoreAdj` integer
      - `Configs` object[]
        - `File` object
          - `Name` string
          - `UID` string
          - `GID` string
          - `Mode` integer
        - `Runtime` object
        - `ConfigID` string
        - `ConfigName` string
      - `Isolation` 'default' | 'process' | 'hyperv' | ''
      - `Init` boolean, nullable
      - `Sysctls` object
      - `CapabilityAdd` string[]
      - `CapabilityDrop` string[]
      - `Ulimits` object[]
        - `Name` string
        - `Soft` integer
        - `Hard` integer
    - `NetworkAttachmentSpec` object — Read-only spec type for non-swarm containers attached to swarm overlay networks. <p><br /></p> > **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 to `attachment`.
      - `ContainerID` string
    - `Resources` object — Resource requirements which apply to each individual container created as part of the service.
      - `Limits` Limit — An object describing a limit on resources which can be requested by a task.
        - `NanoCPUs` integer
        - `MemoryBytes` integer
        - `Pids` integer — Limits the maximum number of PIDs in the container. Set `0` for unlimited.
      - `Reservations` ResourceObject — An object describing the resources which can be advertised by a node and requested by a task.
        - `NanoCPUs` integer
        - `MemoryBytes` integer
        - `GenericResources` object[]
          - `NamedResourceSpec` object
            - `Kind` string
            - `Value` string
          - `DiscreteResourceSpec` object
            - `Kind` string
            - `Value` integer
      - `SwapBytes` integer, nullable
      - `MemorySwappiness` integer, nullable
    - `RestartPolicy` object — Specification for the restart policy which applies to containers created as part of this service.
      - `Condition` 'none' | 'on-failure' | 'any'
      - `Delay` integer
      - `MaxAttempts` integer
      - `Window` integer
    - `Placement` object
      - `Constraints` string[]
      - `Preferences` object[]
        - `Spread` object
          - `SpreadDescriptor` string
      - `MaxReplicas` integer
      - `Platforms` Platform[]
        - `Architecture` string — Architecture represents the hardware architecture (for example, `x86_64`).
        - `OS` string — OS represents the Operating System (for example, `linux` or `windows`).
    - `ForceUpdate` integer — A counter that triggers an update even if no relevant parameters have been changed.
    - `Runtime` string — Runtime is the type of runtime specified for the task executor.
    - `Networks` NetworkAttachmentConfig[] — Specifies which networks the service should attach to.
      - `Target` string — The target network for attachment. Must be a network name or ID.
      - `Aliases` string[] — Discoverable alternate names for the service on this network.
      - `DriverOpts` object — Driver attachment options for the network target.
    - `LogDriver` object — 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.
      - `Name` string
      - `Options` object
  - `ServiceID` string — The ID of the service this task is part of.
  - `Slot` integer
  - `NodeID` string — The ID of the node that this task is on.
  - `AssignedGenericResources` object[]
    - `NamedResourceSpec` object
      - `Kind` string
      - `Value` string
    - `DiscreteResourceSpec` object
      - `Kind` string
      - `Value` integer
  - `Status` TaskStatus — represents the status of a task.
    - `Timestamp` string, date-time
    - `State` 'new' | 'allocated' | 'pending' | 'assigned' | 'accepted' | 'preparing' | 'ready' | 'starting' | 'running' | 'complete' | 'shutdown' | 'failed' | 'rejected' | 'remove' | 'orphaned'
    - `Message` string
    - `Err` string
    - `ContainerStatus` ContainerStatus — represents the status of a container.
      - `ContainerID` string
      - `PID` integer
      - `ExitCode` integer
    - `PortStatus` PortStatus — represents the port status of a task's host ports whose service has published host ports
      - `Ports` EndpointPortConfig[]
        - `Name` string
        - `Protocol` 'tcp' | 'udp' | 'sctp'
        - `TargetPort` integer — The port inside the container.
        - `PublishedPort` integer — The port on the swarm hosts.
        - `PublishMode` 'ingress' | 'host' — The mode in which port is published. <p><br /></p> - "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.
  - `DesiredState` 'new' | 'allocated' | 'pending' | 'assigned' | 'accepted' | 'preparing' | 'ready' | 'starting' | 'running' | 'complete' | 'shutdown' | 'failed' | 'rejected' | 'remove' | 'orphaned'
  - `JobIteration` ObjectVersion — 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.
    - `Index` integer

---

[API](https://skmtc.net/hexlet/apis/docker-engine-api.md) · [All operations](https://skmtc.net/hexlet/apis/docker-engine-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/hexlet/docker-engine-api/versions/7dbd508c79cf/schema)
