Search or ask Docker

Inspect a task

GET /tasks/{id} — Docker Engine API 1.57.

View Markdown
GET/tasks/{id}

Connection and access

API connection and authentication guidance

/v1.57

No HTTP authentication requirement is declared for this operation. Transport access controls can still apply.

Parameters

id path Required

ID of the task

Type: string

All schema constraints and annotations
{
  "type": "string"
}

Request and responses

Response 200

no error

application/json

Schema: Task

Schema example

{
  "AssignedGenericResources": [
    {
      "DiscreteResourceSpec": {
        "Kind": "SSD",
        "Value": 3
      }
    },
    {
      "NamedResourceSpec": {
        "Kind": "GPU",
        "Value": "UUID1"
      }
    },
    {
      "NamedResourceSpec": {
        "Kind": "GPU",
        "Value": "UUID2"
      }
    }
  ],
  "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
  }
}

Response 404

no such task

application/json

Schema: ErrorResponse

Schema example

{
  "message": "Something went wrong."
}

Response 500

server error

application/json

Schema: ErrorResponse

Schema example

{
  "message": "Something went wrong."
}

Response 503

node is not part of a swarm

application/json

Schema: ErrorResponse

Schema example

{
  "message": "Something went wrong."
}

Referenced schemas

#/components/schemas/ErrorResponse

#/components/schemas/Task

Complete operation contract
{
  "operationId": "TaskInspect",
  "parameters": [
    {
      "description": "ID of the task",
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Task"
          }
        }
      },
      "description": "no error"
    },
    "404": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "no such task"
    },
    "500": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "server error"
    },
    "503": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "node is not part of a swarm"
    }
  },
  "summary": "Inspect a task",
  "tags": [
    "Task"
  ]
}