kaniko icon indicating copy to clipboard operation
kaniko copied to clipboard

only enable --cache-dir to cache base images, do not use other cache options.

Open hq-git opened this issue 2 years ago • 1 comments

Actual behavior Kaniko will push cache layers to remote registry when I set --cache=true. From my testing, this behavior doesn't help reducing build time. Kaniko need to push/pull cache layers and uncompress them, which will cost lot of time. Compared to Run steps in Dockerfile, using cache layers doesn't save time. Pushing cache layers to remote registry also has additional cost on network traffic and disk space.

Expected behavior I want to only enable --cache-dir to cache base images, do not use other cache options.

To Reproduce

  1. gcr.io/kaniko-project/executor:v1.20.0-debug
  2. Run command /kaniko/executor --cache=true --cache-dir=/kaniko/cache --snapshot-mode=redo --cleanup --context=. --dockerfile=Dockerfile --destination=harbor.demo.com/test/foo-project:20240130105439

jenkins-pipeline-comprare

hq-git avatar Jan 31 '24 02:01 hq-git

Hi, For me the --cache option reduces build time significantly. However I agree that we should be able to enable base image caching separately from layers caching.

javaDeveloperKid avatar Feb 02 '24 16:02 javaDeveloperKid