-
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
Cache not found from package installs in previous multistage stages #3246
Comments
Perhaps what might help me here is a more fundamental understanding of how caching works. How does the cache algorithm know what the output of the Dockerfile command is going to be before it is run to know whether the cached layer is valid for the command? I'm wondering if the issue here has something to do with apt, pip, or gem package lists or the like. |
Over the past few days, I've also encountered this cache problem in multi-stage builds. It worked fine for months before and I haven't changed anything. |
Seems related to #3254 Our tests revealed that using
A workaround that worked for us was to either remove the workdir directive, or duplicate it across all stages. After that the RUN instruction started using the cache correctly, as previously a different hash was being generated even when nothing changed. This was definitely not an issue before. |
Unfortunately this did not fix my issue, unless there is some problem with using a variable to as an assignment WORKDIR?
|
We ended up moving the WORKDIR directive after any RUN directive wherever possible and it resolved it for us. |
Unfortunately, that does not work for me. Of course, I'm stating the obvious, but being able to drop in Kaniko without touching the Dockerfile at all would be ideal. |
make sure that the directory exists before calling RUN mkdir $INSTALL_PATH
WORKDIR $INSTALL_PATH |
there you go #3340 |
Actual behavior
Apt install commands are not being cached running Kaniko as a Kubernetes job, making image builds very slow
Expected behavior
Cache layer hit/being found since, as far as I can tell, there should be no filesystem differences between builds
To Reproduce
Steps to reproduce the behavior:
Additional Information
The
apt-get update && apt-get install -y curl gnupg ca-certificates --no-install-recommends && apt-get clean
command is not being loaded from cache, all other commands up to this point are loaded from cache. The logs show:No cached layer found for cmd RUN apt-get update && apt-get install -y curl gnupg ca-certificates --no-install-recommends && apt-get clean
This same Dockerfile built in Docker makes use of the cache, making build times much faster.
Triage Notes for the Maintainers
--cache
flagThe text was updated successfully, but these errors were encountered: