gcloud run jobs deploy Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud run jobs deploy - create or update a Cloud Run job
- SYNOPSIS
gcloud run jobs deploy[JOB][--binary-authorization=POLICY][--breakglass=JUSTIFICATION][--container=CONTAINER][--gpu-type=GPU_TYPE][--[no-]gpu-zonal-redundancy][--key=KEY][--labels=[KEY=VALUE,…]][--max-retries=MAX_RETRIES][--parallelism=PARALLELISM][--region=REGION][--remove-containers=[CONTAINER,…]][--service-account=SERVICE_ACCOUNT][--set-cloudsql-instances=[CLOUDSQL-INSTANCES,…]][--task-timeout=TASK_TIMEOUT][--tasks=TASKS; default=1][--vpc-connector=VPC_CONNECTOR][--vpc-egress=VPC_EGRESS][--add-volume=[KEY=VALUE,…]--clear-volumes--remove-volume=[VOLUME,…]][--add-volume-mount=[volume=NAME,mount-path=MOUNT_PATH,…]--args=[ARG,…]--clear-volume-mounts--command=[COMMAND,…]--cpu=CPU--depends-on=[CONTAINER,…]--gpu=GPU--memory=MEMORY--remove-volume-mount=[MOUNT_PATH,…]--startup-probe=[KEY=VALUE,…]--clear-env-vars|--env-vars-file=FILE_PATH|--set-env-vars=[KEY=VALUE,…] |--remove-env-vars=[KEY,…]--update-env-vars=[KEY=VALUE,…]--clear-secrets|--set-secrets=[KEY=VALUE,…] |--remove-secrets=[KEY,…]--update-secrets=[KEY=VALUE,…]--image=IMAGE|--source=SOURCE][--async|--execute-now--wait][--clear-network|--network=NETWORK--subnet=SUBNET--clear-network-tags|--network-tags=[TAG,…]][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
- Creates or updates a Cloud Run job.
- EXAMPLES
- To deploy a new job
my-data-transformationto Cloud Run:gcloudrunjobsdeploymy-data-transformation--image=us-docker.pkg.dev/project/imageYou may also omit the job name. Then a prompt will be displayed with a suggesteddefault value:
gcloudrunjobsdeploy--image=us-docker.pkg.dev/project/image - POSITIONAL ARGUMENTS
- Job resource - Job to deploy. This represents a Cloud resource. (NOTE) Someattributes are not given arguments in this group but can be set in other ways.
To set the
projectattribute:- provide the argument
JOBon the command line with a fully specifiedname; - specify the job name from an interactive prompt with a fully specified name;
- provide the argument
--projecton the command line; - set the property
core/project.
- provide the argument
- [
JOB] - ID of the Job or fully qualified identifier for the Job.
To set the
jobsattribute:- provide the argument
JOBon the command line; - specify the job name from an interactive prompt.
- provide the argument
- Job resource - Job to deploy. This represents a Cloud resource. (NOTE) Someattributes are not given arguments in this group but can be set in other ways.
- FLAGS
--binary-authorization=POLICY- Binary Authorization policy to check against. This must be set to "default".
--breakglass=JUSTIFICATION- Justification to bypass Binary Authorization policy constraints and allow theoperation. Seehttps://cloud.google.com/binary-authorization/docs/using-breakglassfor more information. Next update or deploy command will automatically clearexisting breakglass justification.
--container=CONTAINER- Specifies a container by name. Flags following --container will apply to thespecified container.
Flags that are not container-specific must be specified before --container.
--gpu-type=GPU_TYPE- The GPU type to use.
--[no-]gpu-zonal-redundancy- Set GPU zonal redundancy. Use
--gpu-zonal-redundancyto enable and--no-gpu-zonal-redundancyto disable. --key=KEY- CMEK key reference to encrypt the container with.
--labels=[KEY=VALUE,…]- List of label KEY=VALUE pairs to add.
--max-retries=MAX_RETRIES- Number of times a task is allowed to restart in case of failure before beingfailed permanently. This applies per-task, not per-job. If set to 0, tasks willonly run once and never be retried on failure.
--parallelism=PARALLELISM- Number of tasks that may run concurrently. Must be less than or equal to thenumber of tasks. Set to 0 to unset.
--region=REGION- Region in which the resource can be found. Alternatively, set the property[run/region].
--remove-containers=[CONTAINER,…]- List of containers to remove.
--service-account=SERVICE_ACCOUNT- the email address of an IAM service account associated with the revision of theservice. The service account represents the identity of the running revision,and determines what permissions the revision has.
--set-cloudsql-instances=[CLOUDSQL-INSTANCES,…]- You can specify a name of a Cloud SQL instance if it's in the same project andregion as your Cloud Run resource; otherwise specify<project>:<region>:<instance> for the instance.
--task-timeout=TASK_TIMEOUT- Set the maximum time (deadline) a job task attempt can run for. In the case ofretries, this deadline applies to each attempt of a task. If the task attemptdoes not complete within this time, it will be killed. It is specified as aduration; for example, "10m5s" is ten minutes, and five seconds. If you don'tspecify a unit, seconds is assumed. For example, "10" is 10 seconds.
--tasks=TASKS; default=1- Number of tasks that must run to completion for the execution to be considereddone.
--vpc-connector=VPC_CONNECTOR- Set a VPC connector for this resource.
--vpc-egress=VPC_EGRESS- Specify which of the outbound traffic to send through Direct VPC egress or theVPC connector for this resource. This resource must have Direct VPC egressenabled or a VPC connector to set this flag.
VPC_EGRESSmust be one of:all- (DEPRECATED) Sends all outbound traffic through Direct VPC egress or the VPCconnector. Provides the same functionality as 'all-traffic'. Prefer to use'all-traffic' instead.
all-traffic- Sends all outbound traffic through Direct VPC egress or the VPC connector.
private-ranges-only- Default option. Sends outbound traffic to private IP addresses (RFC 1918 andPrivate Google Access IPs) through Direct VPC egress or the VPC connector.
Traffic to other Cloud Run services might require additional configuration. Seehttps://cloud.google.com/run/docs/securing/private-networking#send_requests_to_other_services_and_servicesfor more information.
--add-volume=[KEY=VALUE,…]- Adds a volume to the Cloud Run resource. To add more than one volume, specifythis flag multiple times. Volumes must have a
nameandtypekey. Only certain values are supported fortype.Depending on the provided type, other keys will be required. The following typesare supported with the specified additional keys:cloud-storage: A volume representing a Cloud Storage bucket. Thisvolume type is mounted using Cloud Storage FUSE. Seehttps://cloud.google.com/storage/docs/gcs-fusefor the details and limitations of this filesystem. Additional keys:- bucket: (required) the name of the bucket to use as the source of this volume
- readonly: (optional) A boolean. If true, this volume will be read-only from allmounts.
- mount-options: (optional) A list of flags to pass to GCSFuse. Flags should bespecified without leading dashes and separated by semicolons.
in-memory: An ephemeral volume that stores data in the instance'smemory. With this type of volume, data is not shared between instances and alldata will be lost when the instance it is on is terminated. Additional keys:- size-limit: (optional) A quantity representing the maximum amount of memoryallocated to this volume, such as "512Mi" or "3G". Data stored in an in-memoryvolume consumes the memory allocation of the container that wrote the data. Ifsize-limit is not specified, the maximum size will be half the total memorylimit of all containers.
nfs: Represents a volume backed by an NFS server. Additional keys:- location: (required) The location of the NFS Server, in the form SERVER:/PATH
- readonly: (optional) A boolean. If true, this volume will be read-only from allmounts.
--clear-volumes- Remove all existing volumes from the Cloud Run resource, including volumesmounted as secrets
--remove-volume=[VOLUME,…]- Removes volumes from the Cloud Run resource.
Ifthe--containeror--remove-containersflagisspecifiedthefollowingargumentsmayonlybespecifiedaftera--containerflag.
--add-volume-mount=[volume=NAME,mount-path=MOUNT_PATH,…]- Adds a mount to the current container. Must contain the keys
volume=NAMEandmount-path=/PATHwhere NAME is thename of a volume on this resource and PATH is the path within the container'sfilesystem to mount this volume. --args=[ARG,…]- Comma-separated arguments passed to the command run by the container image. Ifnot specified and no '--command' is provided, the container image's default Cmdis used. Otherwise, if not specified, no arguments are passed. To reset thisfield to its default, pass an empty string.
--clear-volume-mounts- Remove all existing mounts from the current container.
--command=[COMMAND,…]- Entrypoint for the container image. If not specified, the container image'sdefault Entrypoint is run. To reset this field to its default, pass an emptystring.
--cpu=CPU- Set a CPU limit in Kubernetes cpu units.
Cloud Run supports values fractional values below 1, 1, 2, 4, and 8. Some CPUvalues requires a minimum Memory
--memoryvalue. --depends-on=[CONTAINER,…]- List of container dependencies to add to the current container.
--gpu=GPU- Cloud Run supports values 0 or 1. 1 gpu also requires a minimum 4
--cpuvalue and a minimum 16Gi--memoryvalue. --memory=MEMORY- Set a memory limit. Ex: 1024Mi, 4Gi.
--remove-volume-mount=[MOUNT_PATH,…]- Removes the volume mounted at the specified path from the current container.
--startup-probe=[KEY=VALUE,…]- Comma separated settings for startup probe in the form KEY=VALUE. Each keystands for a field of the probe described inhttps://cloud.google.com/run/docs/reference/rest/v1/Container#Probe.Currently supported keys are: initialDelaySeconds, timeoutSeconds,periodSeconds, failureThreshold, httpGet.port, httpGet.path, grpc.port,grpc.service, tcpSocket.port.
For example, to set a probe with 10s timeout and HTTP probe requests sent to8080 port of the container:
--startup-probe=timeoutSeconds=10,httpGet.port=8080To remove existing probe:
--startup-probe="" - At most one of these can be specified:
--clear-env-vars- Remove all environment variables.
--env-vars-file=FILE_PATH- Path to a local YAML or ENV file with definitions for all environment variables.All existing environment variables will be removed before the new environmentvariables are added. Example YAML content:
KEY_1:"value1"KEY_2:"value 2"
Example ENV content:
KEY_1="value1"KEY_2="value 2"
--set-env-vars=[KEY=VALUE,…]- List of key-value pairs to set as environment variables. All existingenvironment variables will be removed first.
- Or at least one of these can be specified:
- Only --update-env-vars and --remove-env-vars can be used together. If both arespecified, --remove-env-vars will be applied first.
--remove-env-vars=[KEY,…]- List of environment variables to be removed.
--update-env-vars=[KEY=VALUE,…]- List of key-value pairs to set as environment variables.
- Specify secrets to mount or provide as environment variables. Keys starting witha forward slash '/' are mount paths. All other keys correspond to environmentvariables. Values should be in the form SECRET_NAME:SECRET_VERSION. For example:'--update-secrets=/secrets/api/key=mysecret:latest,ENV=othersecret:1' will mounta volume at '/secrets/api' containing a file 'key' with the latest version ofsecret 'mysecret'. An environment variable named ENV will also be created whosevalue is version 1 of secret 'othersecret'.
At most one of these can be specified:
--clear-secrets- Remove all secrets.
--set-secrets=[KEY=VALUE,…]- List of key-value pairs to set as secrets. All existing secrets will be removedfirst.
- Or at least one of these can be specified:
- Only --update-secrets and --remove-secrets can be used together. If both arespecified, --remove-secrets will be applied first.
--remove-secrets=[KEY,…]- List of secrets to be removed.
--update-secrets=[KEY=VALUE,…]- List of key-value pairs to set as secrets.
- At most one of these can be specified:
--image=IMAGE- Name of the container image to deploy (e.g.
us-docker.pkg.dev/cloudrun/container/job:latest). --source=SOURCE- The location of the source to build. If a Dockerfile is present in the sourcecode directory, it will be built using that Dockerfile, otherwise it will useGoogle Cloud buildpacks. Seehttps://cloud.google.com/run/docs/deploying-source-codefor more details. The location can be a directory on a local disk or a gzippedarchive file (.tar.gz) in Google Cloud Storage. If the source is a localdirectory, this command skips the files specified in the
--ignore-file. If--ignore-fileis not specified, use.gcloudignorefile. If a.gcloudignorefile is absentand a.gitignorefile is present in the local source directory,gcloud will use a generated Git-compatible.gcloudignorefile thatrespects your .gitignored files. The global.gitignoreis notrespected. For more information on.gcloudignore, seegcloud topicgcloudignore.
- At most one of these can be specified:
--async- Return immediately, without waiting for the operation in progress to complete.
- Or at least one of these can be specified:
- --async cannot be used if executing the job after the update.
--execute-now- Execute the job immediately after the creation or update completes. gcloud exitsonce the job has started unless the
--waitflag is set. --wait- Wait until the execution has completed running before exiting. If not set,gcloud exits successfully when the execution has started. Implies --execute-now.
- At most one of these can be specified:
--clear-network- Disconnect this Cloud Run job from the VPC network it is connected to.
- Or at least one of these can be specified:
- Direct VPC egress setting flags group.
--network=NETWORK- The VPC network that the Cloud Run job will be able to send traffic to. If--subnet is also specified, subnet must be a subnetwork of the network specifiedby this --network flag. To clear existing VPC network settings, use--clear-network.
--subnet=SUBNET- The VPC subnetwork that the Cloud Run job will get IPs from. The subnetwork mustbe
/26or larger. If --network is also specified, subnet must be asubnetwork of the network specified by the --network flag. If --network is notspecified, network will be looked up from this subnetwork. To clear existing VPCnetwork settings, use --clear-network. - At most one of these can be specified:
--clear-network-tags- Clears all existing network tags from the Cloud Run job.
--network-tags=[TAG,…]- Applies the given network tags (comma separated) to the Cloud Run job. To clearexisting tags, use --clear-network-tags.
- GCLOUD WIDE FLAGS
- These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$gcloud helpfor details. - NOTES
- These variants are also available:
gcloudalpharunjobsdeploygcloudbetarunjobsdeploy
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-01-21 UTC.