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 may be supplied by the system to the container at runtime.
Generated from protobuf message google.cloud.run.v2.Container
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. More info: https://kubernetes.io/docs/concepts/containers/images |
↳ command |
array
Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell |
↳ args |
array
Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell |
↳ env |
array<Google\Cloud\Run\V2\EnvVar>
List of environment variables to set in the container. |
↳ resources |
Google\Cloud\Run\V2\ResourceRequirements
Compute Resource requirements by this container. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources |
↳ ports |
array<Google\Cloud\Run\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<Google\Cloud\Run\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 |
Google\Cloud\Run\V2\Probe
Periodic probe of container liveness. Container will be restarted if the probe fails. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes |
↳ startup_probe |
Google\Cloud\Run\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. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes |
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. More info: https://kubernetes.io/docs/concepts/containers/images
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. More info: https://kubernetes.io/docs/concepts/containers/images
Parameter | |
---|---|
Name | Description |
var |
string
|
Returns | |
---|---|
Type | Description |
$this |
getCommand
Entrypoint array. Not executed within a shell.
The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setCommand
Entrypoint array. Not executed within a shell.
The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
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. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setArgs
Arguments to the entrypoint.
The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
Parameter | |
---|---|
Name | Description |
var |
string[]
|
Returns | |
---|---|
Type | Description |
$this |
getEnv
List of environment variables to set in the container.
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setEnv
List of environment variables to set in the container.
Parameter | |
---|---|
Name | Description |
var |
array<Google\Cloud\Run\V2\EnvVar>
|
Returns | |
---|---|
Type | Description |
$this |
getResources
Compute Resource requirements by this container.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
Returns | |
---|---|
Type | Description |
Google\Cloud\Run\V2\ResourceRequirements|null |
hasResources
clearResources
setResources
Compute Resource requirements by this container.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
Parameter | |
---|---|
Name | Description |
var |
Google\Cloud\Run\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 |
Google\Protobuf\Internal\RepeatedField |
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<Google\Cloud\Run\V2\ContainerPort>
|
Returns | |
---|---|
Type | Description |
$this |
getVolumeMounts
Volume to mount into the container's filesystem.
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setVolumeMounts
Volume to mount into the container's filesystem.
Parameter | |
---|---|
Name | Description |
var |
array<Google\Cloud\Run\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. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
Returns | |
---|---|
Type | Description |
Google\Cloud\Run\V2\Probe|null |
hasLivenessProbe
clearLivenessProbe
setLivenessProbe
Periodic probe of container liveness.
Container will be restarted if the probe fails. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
Parameter | |
---|---|
Name | Description |
var |
Google\Cloud\Run\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. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
Returns | |
---|---|
Type | Description |
Google\Cloud\Run\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. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
Parameter | |
---|---|
Name | Description |
var |
Google\Cloud\Run\V2\Probe
|
Returns | |
---|---|
Type | Description |
$this |