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

Multi stage build cache not cleaned when building multiple images #1829

Open
stratusjerry opened this issue Nov 29, 2021 · 3 comments
Open
Labels
area/multi-stage builds issues related to kaniko multi-stage builds feat/cleanup kind/bug Something isn't working kind/feature-request ok-to-close? possible-dupe priority/p1 Basic need feature compatibility with docker build. we should be working on this next.

Comments

@stratusjerry
Copy link
Contributor

Using kaniko 1.7.0 and previous versions, a multi stage Dockerfile and multiple image builds with the --context and --dockerfile flags and Gitlab CI, the first built image will have data in /kaniko/0 that is not deleted with the use of the --cleanup flag. This results in files from the first image being added to the second image.

Expected behavior
The --cleanup flag should delete the contents of /kaniko/0 after a successful kaniko run

To Reproduce
Forking the Example repos that @AndreKR documented in reporting symlink cleanup issue #1217
This branch uses the cleanup flag and job log shows second image contains a file from the first image
Testing with kaniko version 1.3.0 did not fix the issue
Testing with single snapshot flag did not fix the issue
Manually removing the cache between image builds was the only solution that worked

Related Issues
#1217 #1406

Description Yes/No
Please check if this a new feature you are proposing
Please check if the build works in docker but not in kaniko
Please check if this error is seen when you use --cache flag
Please check if your dockerfile is a multistage dockerfile
@hazam
Copy link

hazam commented Dec 30, 2022

I still see this with v1.9.1

@aaron-prindle aaron-prindle added feat/cleanup area/multi-stage builds issues related to kaniko multi-stage builds possible-dupe kind/bug Something isn't working priority/p1 Basic need feature compatibility with docker build. we should be working on this next. labels Jun 22, 2023
@aaron-prindle
Copy link
Collaborator

aaron-prindle commented Jun 22, 2023

Related: #1586

@AndreKR
Copy link

AndreKR commented Jun 22, 2023

@aaron-prindle I see you changed your mind about this being a duplicate of #1406? Did you find out more?

One difference I can see is this:
The other issues are about files leaking from one build to the next even with --cleanup set while this issue seems to be about files leaking from one stage to the next (and in my opinion mentioning the --cleanup flag here is confusing because between stages files always have to be cleaned up).

But that would still be a bug and not a feature request - what would the feature be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/multi-stage builds issues related to kaniko multi-stage builds feat/cleanup kind/bug Something isn't working kind/feature-request ok-to-close? possible-dupe priority/p1 Basic need feature compatibility with docker build. we should be working on this next.
Projects
None yet
Development

No branches or pull requests

4 participants