google-cloud-runkaniko

How to Clear Kaniko Cache on Build for Cloud Run


So we've updated the dockerfile, and would like to build w/o using the old Kaniko Cache, but want to replace it at the same time.

How to force it to build new cache layers?

gcloud config set builds/use_kaniko True
gcloud beta builds submit --tag="gcr.io/${PROJECT_NAME}/${name}" --timeout="2h" --machine-type="n1-highcpu-32"

Solution

  • Turns out the --no-cache option will also replace the existing Kaniko cache

    gcloud config set builds/use_kaniko True
    gcloud beta builds submit --tag="gcr.io/${PROJECT_NAME}/${name}" --timeout="2h" --machine-type="n1-highcpu-32" --no-cache