GoogleContainerTools / kaniko

Build Container Images In Kubernetes
Apache License 2.0
14.76k stars 1.43k forks source link

kaniko build brokes building image common libraries #3339

Open edib opened 1 week ago

edib commented 1 week ago

Actual behavior A clear and concise description of what the bug is. I have a custom kaniko image that combines Kaniko and git and in gitlab-ci pipeline after kaniko being executed brokes its building container library dependencies. $ git config --global user.email "gitlab-ci@mydomain.com" && git config --global user.name "Gitlab-ci" git: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by git)

Expected behavior A clear and concise description of what you expected to happen. above command should run

To Reproduce Steps to reproduce the behavior:

  1. I have tried alpine and debian and ubunutu base images. all are same.

Additional Information

FROM dotnet-sdk:6.0.1-nuget

RUN apt-get update && \ apt-get install -y git \ apt-get clean && \ rm -rf /var/lib/apt/lists/*

COPY --from=kaniko /kaniko/executor /kaniko/executor COPY --from=kaniko /etc/nsswitch.conf /etc/nsswitch.conf COPY --from=kaniko /kaniko/.docker /kaniko/.docker

RUN dotnet tool install --global dotnet-sonarscanner



 **Triage Notes for the Maintainers**
 <!-- 🎉🎉🎉 Thank you for an opening an issue !!! 🎉🎉🎉
We are doing our best to get to this. Please help us by helping us prioritize your issue by filling the section below -->

 | **Description** | **Yes/No** |
 |----------------|---------------|
 | Please check if this a new feature you are proposing        | <ul><li>- [ ] </li></ul>|
 | Please check if the build works in docker but not in kaniko | <ul><li>- [ ] </li></ul>| 
 | Please check if this error is seen when you use `--cache` flag | <ul><li>- [ ] </li></ul>|
 | Please check if your dockerfile is a multistage dockerfile | <ul><li>- [ ] </li></ul>| 
mzihlmann commented 5 days ago

https://github.com/GoogleContainerTools/kaniko#known-issues

Running kaniko in any Docker image other than the official kaniko image is not supported due to implementation details.

Specifically it is not sufficient to copy the kaniko binary. kaniko depends on the entire filetree being in its expected state. This is not so much a "known issue" but a fundamental design constraint when building an image inside your own container.