public sealed class Runnable.Types.Container : IMessage<Runnable.Types.Container>, IEquatable<Runnable.Types.Container>, IDeepCloneable<Runnable.Types.Container>, IBufferMessage, IMessage
Reference documentation and code samples for the Batch v1 API class Runnable.Types.Container.
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.
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.
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.
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.
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.
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.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe latest version of the \u003ccode\u003eRunnable.Types.Container\u003c/code\u003e class for the Batch v1 API is 2.13.0, with documentation available alongside previous versions dating back to 1.0.0.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eRunnable.Types.Container\u003c/code\u003e is a class representing a container runnable within the Google Cloud Batch service and it implements several interfaces including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eContainer\u003c/code\u003e class allows you to specify various settings for running a container, including image URI, entrypoint, commands, and options, similar to the \u003ccode\u003edocker run\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eFor private Docker registry images, you can provide a username and password, preferably as encrypted secrets via Secret Manager for security.\u003c/p\u003e\n"],["\u003cp\u003eImage streaming can be enabled to allow the runnable to initialize without waiting for the entire container image to download, significantly reducing startup time.\u003c/p\u003e\n"]]],[],null,["# Batch v1 API - Class Runnable.Types.Container (2.13.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.13.0 (latest)](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [2.12.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.12.0/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [2.11.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.11.0/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [2.10.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.10.0/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [2.9.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.9.0/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [2.8.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.8.0/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [2.7.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.7.0/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [2.6.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.6.0/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.5.0/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.4.0/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.3.0/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.2.0/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [2.1.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.1.0/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [2.0.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.0.0/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [1.3.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/1.3.0/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/1.2.0/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/1.1.0/Google.Cloud.Batch.V1.Runnable.Types.Container)\n- [1.0.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/1.0.0/Google.Cloud.Batch.V1.Runnable.Types.Container) \n\n public sealed class Runnable.Types.Container : IMessage\u003cRunnable.Types.Container\u003e, IEquatable\u003cRunnable.Types.Container\u003e, IDeepCloneable\u003cRunnable.Types.Container\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Batch v1 API class Runnable.Types.Container.\n\nContainer runnable. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e Runnable.Types.Container \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[Runnable](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.Runnable)[Types](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.Runnable.Types)[Container](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.Runnable.Types.Container), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Runnable](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.Runnable)[Types](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.Runnable.Types)[Container](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.Runnable.Types.Container), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[Runnable](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.Runnable)[Types](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.Runnable.Types)[Container](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.Runnable.Types.Container), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Batch.V1](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Batch.V1.dll\n\nConstructors\n------------\n\n### Container()\n\n public Container()\n\n### Container(Container)\n\n public Container(Runnable.Types.Container other)\n\nProperties\n----------\n\n### BlockExternalNetwork\n\n public bool BlockExternalNetwork { get; set; }\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### Commands\n\n public RepeatedField\u003cstring\u003e Commands { get; }\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### EnableImageStreaming\n\n public bool EnableImageStreaming { get; set; }\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.\n\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.\n\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### Entrypoint\n\n public string Entrypoint { get; set; }\n\nRequired for some container images. Overrides the `ENTRYPOINT` specified\nin the container.\n\n### ImageUri\n\n public string ImageUri { get; set; }\n\nRequired. The URI to pull the container image from.\n\n### Options\n\n public string Options { get; set; }\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### Password\n\n public string Password { get; set; }\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/*`.\n\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.\n\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### Username\n\n public string Username { get; set; }\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.\n\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.\n\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### Volumes\n\n public RepeatedField\u003cstring\u003e Volumes { get; }\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."]]