Reference documentation and code samples for the Google Cloud Batch V1 Client class Container.
Container runnable.
Generated from protobuf message google.cloud.batch.v1.Runnable.Container
Namespace
Google \ Cloud \ Batch \ V1 \ Runnable
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ image_uri
string
Required. The URI to pull the container image from.
↳ commands
array
Required for some container images. Overrides the CMD specified in the container. If there is an ENTRYPOINT (either in the container image or with the entrypoint field below) then these commands are appended as arguments to the ENTRYPOINT.
↳ entrypoint
string
Required for some container images. Overrides the ENTRYPOINT specified in the container.
↳ volumes
array
Volumes to mount (bind mount) from the host machine files or directories into the container, formatted to match --volume option for the docker run command—for example, /foo:/bar or /foo:/bar:ro. If the TaskSpec.Volumes field is specified but this field is not, Batch will mount each volume from the host machine to the container with the same mount path by default. In this case, the default mount option for containers will be read-only (ro) for existing persistent disks and read-write (rw) for other volume types, regardless of the original mount options specified in TaskSpec.Volumes. If you need different mount settings, you can explicitly configure them in this field.
↳ options
string
Required for some container images. Arbitrary additional options to include in the docker run command when running this container—for example, --network host. For the --volume option, use the volumes field for the container.
↳ block_external_network
bool
If set to true, external network access to and from container will be blocked, containers that are with block_external_network as true can still communicate with each other, network cannot be specified in the container.options field.
↳ username
string
Required if the container image is from a private Docker registry. The username to login to the Docker registry that contains the image. You can either specify the username directly by using plain text or specify an encrypted username by using a Secret Manager secret: projects/*/secrets/*/versions/*. However, using a secret is recommended for enhanced security. Caution: If you specify the username using plain text, you risk the username being exposed to any users who can view the job or its logs. To avoid this risk, specify a secret that contains the username instead. Learn more about Secret Manager and using Secret Manager with Batch.
↳ password
string
Required if the container image is from a private Docker registry. The password to login to the Docker registry that contains the image. For security, it is strongly recommended to specify an encrypted password by using a Secret Manager secret: projects/*/secrets/*/versions/*. Warning: If you specify the password using plain text, you risk the password being exposed to any users who can view the job or its logs. To avoid this risk, specify a secret that contains the password instead. Learn more about Secret Manager and using Secret Manager with Batch.
↳ enable_image_streaming
bool
Optional. If set to true, this container runnable uses Image streaming. Use Image streaming to allow the runnable to initialize without waiting for the entire container image to download, which can significantly reduce startup time for large container images. When enableImageStreaming is set to true, the container runtime is containerd instead of Docker. Additionally, this container runnable only supports the following container subfields: imageUri, commands[], entrypoint, and volumes[]; any other container subfields are ignored. For more information about the requirements and limitations for using Image streaming with Batch, see the image-streaming sample on GitHub.
getImageUri
Required. The URI to pull the container image from.
Returns
Type
Description
string
setImageUri
Required. The URI to pull the container image from.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getCommands
Required for some container images. Overrides the CMD specified in the
container. If there is an ENTRYPOINT (either in the container image or
with the entrypoint field below) then these commands are appended as
arguments to the ENTRYPOINT.
Required for some container images. Overrides the CMD specified in the
container. If there is an ENTRYPOINT (either in the container image or
with the entrypoint field below) then these commands are appended as
arguments to the ENTRYPOINT.
Parameter
Name
Description
var
string[]
Returns
Type
Description
$this
getEntrypoint
Required for some container images. Overrides the ENTRYPOINT specified
in the container.
Returns
Type
Description
string
setEntrypoint
Required for some container images. Overrides the ENTRYPOINT specified
in the container.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getVolumes
Volumes to mount (bind mount) from the host machine files or directories
into the container, formatted to match --volume option for the
docker run command—for example, /foo:/bar or /foo:/bar:ro.
If the TaskSpec.Volumes field is specified but this field is not, Batch
will mount each volume from the host machine to the container with the
same mount path by default. In this case, the default mount option for
containers will be read-only (ro) for existing persistent disks and
read-write (rw) for other volume types, regardless of the original
mount options specified in TaskSpec.Volumes. If you need different
mount settings, you can explicitly configure them in this field.
Volumes to mount (bind mount) from the host machine files or directories
into the container, formatted to match --volume option for the
docker run command—for example, /foo:/bar or /foo:/bar:ro.
If the TaskSpec.Volumes field is specified but this field is not, Batch
will mount each volume from the host machine to the container with the
same mount path by default. In this case, the default mount option for
containers will be read-only (ro) for existing persistent disks and
read-write (rw) for other volume types, regardless of the original
mount options specified in TaskSpec.Volumes. If you need different
mount settings, you can explicitly configure them in this field.
Parameter
Name
Description
var
string[]
Returns
Type
Description
$this
getOptions
Required for some container images. Arbitrary additional options to
include in the docker run command when running this container—for
example, --network host. For the --volume option, use the volumes
field for the container.
Returns
Type
Description
string
setOptions
Required for some container images. Arbitrary additional options to
include in the docker run command when running this container—for
example, --network host. For the --volume option, use the volumes
field for the container.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getBlockExternalNetwork
If set to true, external network access to and from container will be
blocked, containers that are with block_external_network as true can
still communicate with each other, network cannot be specified in the
container.options field.
Returns
Type
Description
bool
setBlockExternalNetwork
If set to true, external network access to and from container will be
blocked, containers that are with block_external_network as true can
still communicate with each other, network cannot be specified in the
container.options field.
Parameter
Name
Description
var
bool
Returns
Type
Description
$this
getUsername
Required if the container image is from a private Docker registry. The
username to login to the Docker registry that contains the image.
You can either specify the username directly by using plain text or
specify an encrypted username by using a Secret Manager secret:
projects/*/secrets/*/versions/*. However, using a secret is
recommended for enhanced security.
Caution: If you specify the username using plain text, you risk the
username being exposed to any users who can view the job or its logs.
To avoid this risk, specify a secret that contains the username instead.
Learn more about Secret
Manager and using
Secret Manager with
Batch.
Returns
Type
Description
string
setUsername
Required if the container image is from a private Docker registry. The
username to login to the Docker registry that contains the image.
You can either specify the username directly by using plain text or
specify an encrypted username by using a Secret Manager secret:
projects/*/secrets/*/versions/*. However, using a secret is
recommended for enhanced security.
Caution: If you specify the username using plain text, you risk the
username being exposed to any users who can view the job or its logs.
To avoid this risk, specify a secret that contains the username instead.
Learn more about Secret
Manager and using
Secret Manager with
Batch.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getPassword
Required if the container image is from a private Docker registry. The
password to login to the Docker registry that contains the image.
For security, it is strongly recommended to specify an
encrypted password by using a Secret Manager secret:
projects/*/secrets/*/versions/*.
Warning: If you specify the password using plain text, you risk the
password being exposed to any users who can view the job or its logs.
To avoid this risk, specify a secret that contains the password instead.
Learn more about Secret
Manager and using
Secret Manager with
Batch.
Returns
Type
Description
string
setPassword
Required if the container image is from a private Docker registry. The
password to login to the Docker registry that contains the image.
For security, it is strongly recommended to specify an
encrypted password by using a Secret Manager secret:
projects/*/secrets/*/versions/*.
Warning: If you specify the password using plain text, you risk the
password being exposed to any users who can view the job or its logs.
To avoid this risk, specify a secret that contains the password instead.
Learn more about Secret
Manager and using
Secret Manager with
Batch.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getEnableImageStreaming
Optional. If set to true, this container runnable uses Image streaming.
Use Image streaming to allow the runnable to initialize without
waiting for the entire container image to download, which can
significantly reduce startup time for large container images.
When enableImageStreaming is set to true, the container
runtime is containerd instead of Docker.
Additionally, this container runnable only supports the following
container subfields: imageUri,
commands[], entrypoint, and
volumes[]; any other container subfields are ignored.
For more information about the requirements and limitations for using
Image streaming with Batch, see the image-streaming
sample on
GitHub.
Returns
Type
Description
bool
setEnableImageStreaming
Optional. If set to true, this container runnable uses Image streaming.
Use Image streaming to allow the runnable to initialize without
waiting for the entire container image to download, which can
significantly reduce startup time for large container images.
When enableImageStreaming is set to true, the container
runtime is containerd instead of Docker.
Additionally, this container runnable only supports the following
container subfields: imageUri,
commands[], entrypoint, and
volumes[]; any other container subfields are ignored.
For more information about the requirements and limitations for using
Image streaming with Batch, see the image-streaming
sample on
GitHub.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Cloud Batch V1 Client - Class Container (1.2.2)\n\nVersion latestkeyboard_arrow_down\n\n- [1.2.2 (latest)](/php/docs/reference/cloud-batch/latest/V1.Runnable.Container)\n- [1.2.1](/php/docs/reference/cloud-batch/1.2.1/V1.Runnable.Container)\n- [1.1.7](/php/docs/reference/cloud-batch/1.1.7/V1.Runnable.Container)\n- [1.0.3](/php/docs/reference/cloud-batch/1.0.3/V1.Runnable.Container)\n- [0.17.0](/php/docs/reference/cloud-batch/0.17.0/V1.Runnable.Container)\n- [0.16.10](/php/docs/reference/cloud-batch/0.16.10/V1.Runnable.Container)\n- [0.15.0](/php/docs/reference/cloud-batch/0.15.0/V1.Runnable.Container)\n- [0.14.0](/php/docs/reference/cloud-batch/0.14.0/V1.Runnable.Container)\n- [0.13.1](/php/docs/reference/cloud-batch/0.13.1/V1.Runnable.Container)\n- [0.12.1](/php/docs/reference/cloud-batch/0.12.1/V1.Runnable.Container)\n- [0.11.3](/php/docs/reference/cloud-batch/0.11.3/V1.Runnable.Container)\n- [0.10.0](/php/docs/reference/cloud-batch/0.10.0/V1.Runnable.Container)\n- [0.9.0](/php/docs/reference/cloud-batch/0.9.0/V1.Runnable.Container)\n- [0.8.0](/php/docs/reference/cloud-batch/0.8.0/V1.Runnable.Container)\n- [0.7.0](/php/docs/reference/cloud-batch/0.7.0/V1.Runnable.Container)\n- [0.6.0](/php/docs/reference/cloud-batch/0.6.0/V1.Runnable.Container)\n- [0.5.2](/php/docs/reference/cloud-batch/0.5.2/V1.Runnable.Container)\n- [0.4.0](/php/docs/reference/cloud-batch/0.4.0/V1.Runnable.Container)\n- [0.3.0](/php/docs/reference/cloud-batch/0.3.0/V1.Runnable.Container)\n- [0.2.2](/php/docs/reference/cloud-batch/0.2.2/V1.Runnable.Container) \nReference documentation and code samples for the Google Cloud Batch V1 Client class Container.\n\nContainer runnable.\n\nGenerated from protobuf message `google.cloud.batch.v1.Runnable.Container`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Batch \\\\ V1 \\\\ Runnable\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getImageUri\n\nRequired. The URI to pull the container image from.\n\n### setImageUri\n\nRequired. The URI to pull the container image from.\n\n### getCommands\n\nRequired for some container images. Overrides the `CMD` specified in the\ncontainer. If there is an `ENTRYPOINT` (either in the container image or\nwith the `entrypoint` field below) then these commands are appended as\narguments to the `ENTRYPOINT`.\n\n### setCommands\n\nRequired for some container images. Overrides the `CMD` specified in the\ncontainer. If there is an `ENTRYPOINT` (either in the container image or\nwith the `entrypoint` field below) then these commands are appended as\narguments to the `ENTRYPOINT`.\n\n### getEntrypoint\n\nRequired for some container images. Overrides the `ENTRYPOINT` specified\nin the container.\n\n### setEntrypoint\n\nRequired for some container images. Overrides the `ENTRYPOINT` specified\nin the container.\n\n### getVolumes\n\nVolumes to mount (bind mount) from the host machine files or directories\ninto the container, formatted to match `--volume` option for the\n`docker run` command---for example, `/foo:/bar` or `/foo:/bar:ro`.\n\nIf the `TaskSpec.Volumes` field is specified but this field is not, Batch\nwill mount each volume from the host machine to the container with the\nsame mount path by default. In this case, the default mount option for\ncontainers will be read-only (`ro`) for existing persistent disks and\nread-write (`rw`) for other volume types, regardless of the original\nmount options specified in `TaskSpec.Volumes`. If you need different\nmount settings, you can explicitly configure them in this field.\n\n### setVolumes\n\nVolumes to mount (bind mount) from the host machine files or directories\ninto the container, formatted to match `--volume` option for the\n`docker run` command---for example, `/foo:/bar` or `/foo:/bar:ro`.\n\nIf the `TaskSpec.Volumes` field is specified but this field is not, Batch\nwill mount each volume from the host machine to the container with the\nsame mount path by default. In this case, the default mount option for\ncontainers will be read-only (`ro`) for existing persistent disks and\nread-write (`rw`) for other volume types, regardless of the original\nmount options specified in `TaskSpec.Volumes`. If you need different\nmount settings, you can explicitly configure them in this field.\n\n### getOptions\n\nRequired for some container images. Arbitrary additional options to\ninclude in the `docker run` command when running this container---for\nexample, `--network host`. For the `--volume` option, use the `volumes`\nfield for the container.\n\n### setOptions\n\nRequired for some container images. Arbitrary additional options to\ninclude in the `docker run` command when running this container---for\nexample, `--network host`. For the `--volume` option, use the `volumes`\nfield for the container.\n\n### getBlockExternalNetwork\n\nIf set to true, external network access to and from container will be\nblocked, containers that are with block_external_network as true can\nstill communicate with each other, network cannot be specified in the\n`container.options` field.\n\n### setBlockExternalNetwork\n\nIf set to true, external network access to and from container will be\nblocked, containers that are with block_external_network as true can\nstill communicate with each other, network cannot be specified in the\n`container.options` field.\n\n### getUsername\n\nRequired if the container image is from a private Docker registry. The\nusername to login to the Docker registry that contains the image.\n\nYou can either specify the username directly by using plain text or\nspecify an encrypted username by using a Secret Manager secret:\n`projects/*/secrets/*/versions/*`. However, using a secret is\nrecommended for enhanced security.\nCaution: If you specify the username using plain text, you risk the\nusername being exposed to any users who can view the job or its logs.\nTo avoid this risk, specify a secret that contains the username instead.\nLearn more about [Secret\nManager](https://cloud.google.com/secret-manager/docs/) and [using\nSecret Manager with\nBatch](https://cloud.google.com/batch/docs/create-run-job-secret-manager).\n\n### setUsername\n\nRequired if the container image is from a private Docker registry. The\nusername to login to the Docker registry that contains the image.\n\nYou can either specify the username directly by using plain text or\nspecify an encrypted username by using a Secret Manager secret:\n`projects/*/secrets/*/versions/*`. However, using a secret is\nrecommended for enhanced security.\nCaution: If you specify the username using plain text, you risk the\nusername being exposed to any users who can view the job or its logs.\nTo avoid this risk, specify a secret that contains the username instead.\nLearn more about [Secret\nManager](https://cloud.google.com/secret-manager/docs/) and [using\nSecret Manager with\nBatch](https://cloud.google.com/batch/docs/create-run-job-secret-manager).\n\n### getPassword\n\nRequired if the container image is from a private Docker registry. The\npassword to login to the Docker registry that contains the image.\n\nFor security, it is strongly recommended to specify an\nencrypted password by using a Secret Manager secret:\n`projects/*/secrets/*/versions/*`.\nWarning: If you specify the password using plain text, you risk the\npassword being exposed to any users who can view the job or its logs.\nTo avoid this risk, specify a secret that contains the password instead.\nLearn more about [Secret\nManager](https://cloud.google.com/secret-manager/docs/) and [using\nSecret Manager with\nBatch](https://cloud.google.com/batch/docs/create-run-job-secret-manager).\n\n### setPassword\n\nRequired if the container image is from a private Docker registry. The\npassword to login to the Docker registry that contains the image.\n\nFor security, it is strongly recommended to specify an\nencrypted password by using a Secret Manager secret:\n`projects/*/secrets/*/versions/*`.\nWarning: If you specify the password using plain text, you risk the\npassword being exposed to any users who can view the job or its logs.\nTo avoid this risk, specify a secret that contains the password instead.\nLearn more about [Secret\nManager](https://cloud.google.com/secret-manager/docs/) and [using\nSecret Manager with\nBatch](https://cloud.google.com/batch/docs/create-run-job-secret-manager).\n\n### getEnableImageStreaming\n\nOptional. If set to true, this container runnable uses Image streaming.\n\nUse Image streaming to allow the runnable to initialize without\nwaiting for the entire container image to download, which can\nsignificantly reduce startup time for large container images.\nWhen `enableImageStreaming` is set to true, the container\nruntime is [containerd](https://containerd.io/) instead of Docker.\nAdditionally, this container runnable only supports the following\n`container` subfields: `imageUri`,\n`commands[]`, `entrypoint`, and\n`volumes[]`; any other `container` subfields are ignored.\nFor more information about the requirements and limitations for using\nImage streaming with Batch, see the [`image-streaming`\nsample on\nGitHub](https://github.com/GoogleCloudPlatform/batch-samples/tree/main/api-samples/image-streaming).\n\n### setEnableImageStreaming\n\nOptional. If set to true, this container runnable uses Image streaming.\n\nUse Image streaming to allow the runnable to initialize without\nwaiting for the entire container image to download, which can\nsignificantly reduce startup time for large container images.\nWhen `enableImageStreaming` is set to true, the container\nruntime is [containerd](https://containerd.io/) instead of Docker.\nAdditionally, this container runnable only supports the following\n`container` subfields: `imageUri`,\n`commands[]`, `entrypoint`, and\n`volumes[]`; any other `container` subfields are ignored.\nFor more information about the requirements and limitations for using\nImage streaming with Batch, see the [`image-streaming`\nsample on\nGitHub](https://github.com/GoogleCloudPlatform/batch-samples/tree/main/api-samples/image-streaming)."]]