-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Image sizes increased dramatically since merging #289 #314
Comments
That's not good! Thanks for reporting this @lubo - do you happen to have an example of how to reproduce this? |
Sure. The Dockerfiles I've been testing Kaniko with look like this: FROM image as installer
RUN <install files into /install>
COPY more files /install
FROM image
COPY --from=installer /install / So, I use multi-stage builds. In the first stage, |
I used this test Dockerfile and was able to repro this @ HEAD:
I used I actually don't think this is a bug. #289 changed the logic here to better determine if we want to snapshot the entire filesystem or just certain files after each command. Before #289 we defaulted to snapshotting the entire filesystem after the last command, so you wouldn't have seen a huge log message detailing the exact files to snapshot. Now that the logic is correct, since you're copying to root ( We could change the code to not print out all the files we're snapshotting and instead just say something like ( |
Whoops, please disregard my above comment, I just tried again with the same Dockerfile and it does seem like there's some sort of bug 😰 Update: The COPY command gets the files to snapshot by getting all files copied to the destination here, and in this case the destination is root ( @bobcatfish , WDYT would make sense here? |
Before GoogleContainerTools#289 was merged, when copying over directories for COPY kaniko would get a list of all files at the destination specified and add them to the list of files to be snapshotted. If the destination was root it would add all files. This worked because the snapshotter made sure the file had been changed before adding it to the layer. After GoogleContainerTools#289, we changed the logic to add all files snapshotted to a layer without checking if the files had been changed. This created the bug in got all the files at root and added them to the layer without checking if they had been changed. This change should fix this bug. Now, the CopyDir function returns a list of files it copied over and only those files are added to the list of files to be snapshotted. Should fix GoogleContainerTools#314
Since merging #289, Kaniko seems to create layers containing not only the files copied by
COPY
instruction, but also files from the previous layers.The text was updated successfully, but these errors were encountered: