Set maximum retries (jobs)

A Cloud Run job consists of one or more tasks. The maximum retries setting specifies the number of times a task is allowed to restart in case of failure before being failed permanently. The default is 3.

This setting applies per-task, not per-job. If you set this to 0, tasks only run once and are not retried on failure.

To specify maximum retries:

  1. For a job you are creating:

    gcloud beta run jobs create JOB_NAME --image IMAGE_URL --max-retries RETRY

    Replace

    • JOB_NAME with the name of your job.
    • IMAGE_URL with a reference to the container image, for example, us-docker.pkg.dev/cloudrun/container/job:latest.
    • RETRY with the number of retries: specify an integer from 0 to 10.
  2. For a job you are updating:

    gcloud beta run jobs update JOB_NAME --max-retries RETRY

View task timeout settings

To view the current task timeout settings for your Cloud Run job:

Command line

  1. Use the following command:

    gcloud beta run jobs describe JOB_NAME
  2. Locate the task timeout setting in the returned configuration.