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

What does the --cache-copy-layers flag do? #1940

Open
tal-zvon opened this issue Feb 15, 2022 · 1 comment
Open

What does the --cache-copy-layers flag do? #1940

tal-zvon opened this issue Feb 15, 2022 · 1 comment

Comments

@tal-zvon
Copy link

This isn't exactly a bug report. Just a question, with maybe a suggestion for some additional documentation.

According to the caching section of the kaniko README:

kaniko can cache layers created by RUN and COPY (configured by flag --cache-copy-layers) commands in a remote repository

This makes it sound like either all RUN and COPY commands are always cached, or they're not, depending on if --cache-copy-layers is set.

Most people reading this are probably already aware that according to docker's cache page, RUN commands are always cached, as long as the command itself in the dockerfile hasn't changed, and COPY commands store file hashes along with the image, and only invalidate the cache if the files being copied changed.

Is this how kaniko works WITHOUT the --cache-copy-layers flag? Is this how kaniko works WITH the --cache-copy-layers flag? Or does Kaniko work completely differently than how docker works, and either enables or disables caching of RUN and COPY commands, without using file hashes for the COPY command, or string comparisons for the RUN command?

@korenyoni
Copy link
Contributor

korenyoni commented Apr 27, 2022

Agreed, the README is a bit misleading at the moment.

In terms of what this flag actually does, there is context #1408 and #1518.

It looks like the flag only has to do with the COPY command, no? I think the README may be misleading / inaccurate in mentioning RUN in the context of --cache-copy-layers. In fact the flag name suddenly makes a lot more sense if it's only talking about COPY and not RUN.

It's probably just a grammatical issue. If you look at this commit, it probably meant kaniko can cache layers created by RUN (and COPY, configured by flag --cache-copy-layers) commands in a remote repository instead of kaniko can cache layers created by RUN and COPY (configured by flag --cache-copy-layers) commands in a remote repository (notice the location of the left bracket).

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

No branches or pull requests

3 participants