# Google Cloud Run V2 Client - Class Container (1.12.2)

1.12.2 (latest) 1.12.1 1.11.0 1.10.1 1.9.0 1.8.0 1.7.0 1.6.0 1.5.2 1.4.0 1.3.0 1.2.0 1.1.0 1.0.0 0.9.3 0.8.0 0.7.2 0.6.0 0.5.2 0.4.0 0.3.4 Reference documentation and code samples for the Google Cloud Run V2 Client class Container.

A single application container.

This specifies both the container to run, the command to run in the container
and the arguments to supply to it.
Note that additional arguments can be supplied by the system to the container
at runtime.

Generated from protobuf message `google.cloud.run.v2.Container`

## Namespace

Google \\ Cloud \\ Run \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Name of the container specified as a DNS_LABEL (RFC 1123). |
| `↳ image` | `string` Required. Name of the container image in Dockerhub, Google Artifact Registry, or Google Container Registry. If the host is not provided, Dockerhub is assumed. |
| `↳ source_code` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.SourceCode` Optional. Location of the source. |
| `↳ command` | `string[]` Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. |
| `↳ args` | `string[]` Arguments to the entrypoint. The docker image's CMD is used if this is not provided. |
| `↳ env` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.EnvVar>` List of environment variables to set in the container. |
| `↳ resources` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.ResourceRequirements` Compute Resource requirements by this container. |
| `↳ ports` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.ContainerPort>` List of ports to expose from the container. Only a single port can be specified. The specified ports must be listening on all interfaces (0.0.0.0) within the container to be accessible. If omitted, a port number will be chosen and passed to the container through the PORT environment variable for the container to listen on. |
| `↳ volume_mounts` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.VolumeMount>` Volume to mount into the container's filesystem. |
| `↳ working_dir` | `string` Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. |
| `↳ liveness_probe` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.Probe` Periodic probe of container liveness. Container will be restarted if the probe fails. |
| `↳ startup_probe` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.Probe` Startup probe of application within the container. All other probes are disabled if a startup probe is provided, until it succeeds. Container will not be added to service endpoints if the probe fails. |
| `↳ readiness_probe` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.Probe` Readiness probe to be used for health checks. |
| `↳ depends_on` | `string[]` Names of the containers that must start before this container. |
| `↳ base_image_uri` | `string` Base image for this container. Only supported for services. If set, it indicates that the service is enrolled into automatic base image update. |
| `↳ build_info` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.BuildInfo` Output only. The build info of the container image. |

### getName

Name of the container specified as a DNS_LABEL (RFC 1123).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Name of the container specified as a DNS_LABEL (RFC 1123).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getImage

Required. Name of the container image in Dockerhub, Google Artifact
Registry, or Google Container Registry. If the host is not provided,
Dockerhub is assumed.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setImage

Required. Name of the container image in Dockerhub, Google Artifact
Registry, or Google Container Registry. If the host is not provided,
Dockerhub is assumed.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSourceCode

Optional. Location of the source.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.SourceCode|null` |   |

### hasSourceCode

### clearSourceCode

### setSourceCode

Optional. Location of the source.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.SourceCode` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCommand

Entrypoint array. Not executed within a shell.

The docker image's ENTRYPOINT is used if this is not provided.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setCommand

Entrypoint array. Not executed within a shell.

The docker image's ENTRYPOINT is used if this is not provided.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getArgs

Arguments to the entrypoint.

The docker image's CMD is used if this is not provided.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setArgs

Arguments to the entrypoint.

The docker image's CMD is used if this is not provided.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getEnv

List of environment variables to set in the container.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.EnvVar>` |   |

### setEnv

List of environment variables to set in the container.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.EnvVar>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getResources

Compute Resource requirements by this container.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.ResourceRequirements|null` |   |

### hasResources

### clearResources

### setResources

Compute Resource requirements by this container.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.ResourceRequirements` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPorts

List of ports to expose from the container. Only a single port can be
specified. The specified ports must be listening on all interfaces
(0.0.0.0) within the container to be accessible.

If omitted, a port number will be chosen and passed to the container
through the PORT environment variable for the container to listen on.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.ContainerPort>` |   |

### setPorts

List of ports to expose from the container. Only a single port can be
specified. The specified ports must be listening on all interfaces
(0.0.0.0) within the container to be accessible.

If omitted, a port number will be chosen and passed to the container
through the PORT environment variable for the container to listen on.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.ContainerPort>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getVolumeMounts

Volume to mount into the container's filesystem.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.VolumeMount>` |   |

### setVolumeMounts

Volume to mount into the container's filesystem.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.VolumeMount>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getWorkingDir

Container's working directory.

If not specified, the container runtime's default will be used, which
might be configured in the container image.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setWorkingDir

Container's working directory.

If not specified, the container runtime's default will be used, which
might be configured in the container image.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getLivenessProbe

Periodic probe of container liveness.

Container will be restarted if the probe fails.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.Probe|null` |   |

### hasLivenessProbe

### clearLivenessProbe

### setLivenessProbe

Periodic probe of container liveness.

Container will be restarted if the probe fails.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.Probe` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getStartupProbe

Startup probe of application within the container.

All other probes are disabled if a startup probe is provided, until it
succeeds. Container will not be added to service endpoints if the probe
fails.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.Probe|null` |   |

### hasStartupProbe

### clearStartupProbe

### setStartupProbe

Startup probe of application within the container.

All other probes are disabled if a startup probe is provided, until it
succeeds. Container will not be added to service endpoints if the probe
fails.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.Probe` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getReadinessProbe

Readiness probe to be used for health checks.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.Probe|null` |   |

### hasReadinessProbe

### clearReadinessProbe

### setReadinessProbe

Readiness probe to be used for health checks.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.Probe` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDependsOn

Names of the containers that must start before this container.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setDependsOn

Names of the containers that must start before this container.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getBaseImageUri

Base image for this container. Only supported for services. If set, it
indicates that the service is enrolled into automatic base image update.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setBaseImageUri

Base image for this container. Only supported for services. If set, it
indicates that the service is enrolled into automatic base image update.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getBuildInfo

Output only. The build info of the container image.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.BuildInfo|null` |   |

### hasBuildInfo

### clearBuildInfo

### setBuildInfo

Output only. The build info of the container image.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.BuildInfo` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |