# Task

- [JSON representation](https://docs.cloud.google.com/deploy/docs/api/reference/rest/v1/Task#SCHEMA_REPRESENTATION)
- [ContainerTask](https://docs.cloud.google.com/deploy/docs/api/reference/rest/v1/Task#ContainerTask)
  - [JSON representation](https://docs.cloud.google.com/deploy/docs/api/reference/rest/v1/Task#ContainerTask.SCHEMA_REPRESENTATION)

A Task represents a unit of work that is executed as part of a Job.

| JSON representation |
|---|
| ``` { // Union field `type` can be only one of the following: "container": { object (`https://docs.cloud.google.com/deploy/docs/api/reference/rest/v1/Task#ContainerTask`) } // End of list of possible types for union field `type`. } ``` |

| Fields ||
|---|---|
| Union field `type`. The type of Task. `type` can be only one of the following: ||
| `container` | ``object (`https://docs.cloud.google.com/deploy/docs/api/reference/rest/v1/Task#ContainerTask`)`` Optional. This task is represented by a container that is executed in the Cloud Build execution environment. |

## ContainerTask

This task is represented by a container that is executed in the Cloud Build execution environment.

| JSON representation |
|---|
| ``` { "image": string, "command": [ string ], "args": [ string ], "env": { string: string, ... } } ``` |

| Fields ||
|---|---|
| `image` | `string` Required. Image is the container image to use. |
| `command[]` | `string` Optional. Command is the container entrypoint to use. This overrides the default entrypoint defined in the container image. |
| `args[]` | `string` Optional. Args is the container arguments to use. This overrides the default arguments defined in the container image. |
| `env` | `map (key: string, value: string)` Optional. Environment variables that are set in the container. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |