Set maximum retries for jobs Stay organized with collections Save and categorize content based on your preferences.
A Cloud Run job consists of one or more tasks. The maximum retriessetting specifies the number of times a task is allowed to restart in case offailure before being failed permanently. The default is3.
This setting applies per-task, not per-job. If you set this to 0, tasks only runonce and are not retried on failure.
Required roles
To get the permissions that you need to configure Cloud Run jobs, ask your administrator to grant you the following IAM roles:
- Cloud Run Developer (
roles/run.developer) on the Cloud Run job - Service Account User (
roles/iam.serviceAccountUser) on the service identity
For a list of IAM roles and permissions that are associated withCloud Run, seeCloud Run IAM rolesandCloud Run IAM permissions.If your Cloud Run job interfaces withGoogle Cloud APIs, such as Cloud Client Libraries, see theservice identity configuration guide.For more information about granting roles, seedeployment permissionsandmanage access.
Configure maximum retries
To specify maximum retries:
Console
In the Google Cloud console, go to the Cloud RunJobs page:
ClickDeploy container to fill outthe initial job settings page. If you are configuring an existing job,select the job, then clickView and edit job configuration.
ClickContainer(s), Volumes, Connections, Security to expand the job properties page.
Click theGeneral tab.

- Specify the number of retries using an integer from0 to 10.
ClickCreate orUpdate.
gcloud
For a job you are creating:
gcloudrunjobscreateJOB_NAME--imageIMAGE_URL--max-retriesRETRYReplace
- JOB_NAME with the name of your job.
- IMAGE_URL: a reference to thecontainer image—forexample,
us-docker.pkg.dev/cloudrun/container/job:latest. - RETRY with the number of retries: specify an integer from 0 to10.
For a job you are updating:
gcloudrunjobsupdateJOB_NAME--max-retriesRETRY
YAML
If you are creating a new job, skip this step.If you are updating an existing job, download itsYAML configuration:
gcloudrunjobsdescribeJOB_NAME--formatexport>job.yaml
Update the
maxRetries:attribute:apiVersion:run.googleapis.com/v1kind:Jobmetadata:name:JOBspec:template:spec:template:spec:containers:-image:IMAGEmaxRetries:RETRIES
ReplaceRETRIES with the number of retries: specify an integerfrom
0to10.You can also specify more configuration such as environment variables ormemory limits.
Update the existing job configuration:
gcloudrunjobsreplacejob.yaml
Terraform
To learn how to apply or remove a Terraform configuration, seeBasic Terraform commands.
Add the following to agoogle_cloud_run_v2_job resource in your Terraform configuration:resource"google_cloud_run_v2_job""default"{name="cloud-run-job-retries"location="us-central1"deletion_protection=false # set to "true" in productiontemplate{template{max_retries=3containers{image="us-docker.pkg.dev/cloudrun/container/job:latest"}}}}View maximum retries settings
To view the current maximum retries settings for yourCloud Run job:
Console
In the Google Cloud console, go to the Cloud Run jobs page:
Click the job you are interested in to open theJob details page.
ClickView and Edit job configuration.
Locate the maximum retries setting in the configurationdetails.
gcloud
Use the following command:
gcloudrunjobsdescribeJOB_NAMELocate the maximum retries setting in the returnedconfiguration.
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-02-18 UTC.