Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return caching COPY layers #1489

Closed
YevheniiSemendiak opened this issue Nov 11, 2020 · 3 comments · Fixed by #1518
Closed

Return caching COPY layers #1489

YevheniiSemendiak opened this issue Nov 11, 2020 · 3 comments · Fixed by #1518

Comments

@YevheniiSemendiak
Copy link

Hey folks!
First of all, thank you for your outstanding and such usefull tool!

I have a question to
In #1408 you've removed the logic for caching COPY steps of dockerfiles.

My question is: Is it possible to return it back, at least by enabling it with some flag, such as --cache-copy-layers.

The intent is pretty straightforward - not all users are copying large amounts of data into containers, but only tiny config files, etc. For instance, in my case, the performance degradation is 4x if I compare v1.2.0 vs 1.1.0.

@ByJacob
Copy link

ByJacob commented Nov 13, 2020

I have a similar problem. Each time I copies the same files, he gets different docker layers.

My case:

  • create 3 files
    fallocate -l 14M test1.img; fallocate -l 14M test2.img; fallocate -l 14M test3.img
  • create Dockerfile
FROM alpine
COPY test1.img /test1.img
COPY test2.img /test3.img
COPY test3.img /test2.img
  • pull latest kaniko image
docker pull gcr.io/kaniko-project/executor:debug
  • build image
docker run --rm -i -v /home/USERNAME/.docker/config.json:/kaniko/.docker/config.json -v `pwd`:/app -w /app gcr.io/kaniko-project/executor:debug --context /app --destination repository/test-build --cache
  • pull image
    docker pull repository/test-build
  • build image second time
docker run --rm -i -v /home/USERNAME/.docker/config.json:/kaniko/.docker/config.json -v `pwd`:/app -w /app gcr.io/kaniko-project/executor:debug --context /app --destination repository/test-build --cache
  • pull image
    docker pull repository/test-build

Expected:

  • nothing download because build docker with the same files

Current:

  • download 3 layers when pull second time

@slinstaedt
Copy link

Same here. I realized a speedup of 10-20% for copy-heavy images, with the downside of copy-layers not being reused in subsequent builds, even though copied files have the same hash.

The speedup at image build time is mostly negated at runtime, when every cluster node has to pull gigs of meant to be cached layers, instead of the one build job, pulling them once.

@tejal29
Copy link
Contributor

tejal29 commented Dec 9, 2020

Thank you folks for the feedback. It is possible to bring this feature back with a flags. I will work on this week before Friday's release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants