kaniko icon indicating copy to clipboard operation
kaniko copied to clipboard

Kaniko Multi Stage Build Issue

Open isagargit opened this issue 8 months ago • 2 comments

we use kaniko to build docker images. in our current setup, we are to build an image using Kaniko and run commands after the executor. In case of a single stage, it works flawless.

But, when we are running a multi stage image build, the context of the image our image build is running on gets lost and we get a command not found error for the package that's installed on the container image.

please assist if there's a workaround for it. I have tried --cleanup=false & --cache=true, doesn't work.

found a similar kinda issue here: https://github.com/GoogleContainerTools/kaniko/issues/3325

isagargit avatar Apr 08 '25 10:04 isagargit

FWIW, I wrote a blog post about moving away from kaniko https://jontechblog.com/blog/migrating-from-kaniko-to-docker-in-cloud-build-for-multi-stage-caching/

I use kaniko just for the caching feature, and with multi-stage builds and with Google Cloud no longer recommending kaniko as a caching tool for Cloud Build, I think it's time to move on.

ernsheong avatar May 23 '25 12:05 ernsheong

If you're still looking for a solution to this you could give my fork a try https://github.com/mzihlmann/kaniko/releases/ It fixes this issue and a few more, mostly related to caching, if you have other issues you would like to see resolved please let me know. I know that this is not ideal and I hope we can get the changes merged here eventually but for now that's the best I can offer. If you like what you see you can support me with a star, thank you 🙇

mzihlmann avatar Jun 02 '25 07:06 mzihlmann