Kaniko layer caching on ECR

Hi all,

I wanted to point out an issue we bumped into with Kaniko as we were migrating a project from GCP to AWS. In the process we moved our images from GCR to ECR.

We use Kaniko for in-cluster building and everything worked smoothly on GCP. After moving to ECR we noticed that builds took much longer and it turns out we weren’t getting the image layer caches. Instead everything was being built from scratch.

Turns out, we had to create the cache repo manually on ECR.

That is, if you have a repository like, my-org/my-image , you need to manually create a repository next to it called my-org/my-image/cache .

You can also select a different name for the cache repository and pass the path to Kaniko via the --cache-repo flag, which you can set on the extraFlags field. See this GitHub comment in the Kaniko repo for more details.

This did not appear to be the case for GCR on GCP. We haven’t tested this on other container repositories.

We’ve updated our docs and FAQ to reflect this.

1 Like

Thank you for sharing!

1 Like