kaniko icon indicating copy to clipboard operation
kaniko copied to clipboard

error building image: error building stage: failed to take snapshot: archive/tar: write too long

Open ltx0633 opened this issue 2 years ago • 9 comments

Actual behavior A clear and concise description of what the bug is. I was building a python project and there was an error in the "Taking snapshot of files..." phase

image

To Reproduce Steps to reproduce the behavior: I use kaniko as a build container in jenkins. Everything seemed fine at first. Since I added a certain pip package, I began to make errors. I think it is because the files have been added to the tar file limit.

Additional Information

  • Dockerfile
FROM python:3.10.12-alpine3.17

WORKDIR /usr/local/service

ENV PYTHONPATH /usr/lib/python3.10/site-packages
RUN  apk add --no-cache tzdata gcc  libffi-dev  musl-dev build-base linux-headers py3-pandas 

COPY server/requirements.txt .

RUN pip install -r requirements.txt 

COPY server .

RUN chmod +x start.sh

CMD ["./start.sh"]
  • Build Context
"/kaniko/executor -f `pwd`/${name}  --push-retry=3 -c `pwd`     --use-new-run  --snapshotMode=redo --insecure --skip-tls-verify --cache=true --destination=test-harbor.xxxxx.com/aimath/${cfg.project_name}-${project_name}:$BUILD_NUMBER"
  • Kaniko Image (fully qualified with digest) gcr.io/kaniko-project/executor:debug@sha256:91ffcd7c7450560c235406479a476b632efeef9ca036ca4ce32de395a580f83a

Triage Notes for the Maintainers

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
  • - [yes]
Please check if this error is seen when you use --cache flag
  • - [ yes]
Please check if your dockerfile is a multistage dockerfile
  • - [ no ]

ltx0633 avatar Nov 06 '23 07:11 ltx0633

The following is requirements.txt

PyMySQL==1.0.2
sqlparse==0.4.1
Django==3.2.6
djangorestframework==3.12.4
drf-yasg==1.21.3
requests==2.26.0
djangorestframework-simplejwt==5.2.0
django-filter==21.1
uWSGI
phone==0.4.3
sentry-sdk==1.5.7
django-cors-headers==3.10.0
django-rest-swagger==2.2.0
cos-python-sdk-v5
django-redis==5.2.0
pymongo==3.12.0
openpyxl==3.0.7
alibabacloud_push20160801==1.0.3
xlrd2

ltx0633 avatar Nov 06 '23 07:11 ltx0633

@ltx0633 was this issue solved somehow or any workaround for this? same error for me.

ganeshgk avatar Nov 21 '23 07:11 ganeshgk

@ltx0633 was this issue solved somehow or any workaround for this? same error for me.

Maybe it's the tar module, but I'm not an expert in the go language. I built it using buildkit, Buildkit is faster than kaniko. There are fewer mistakes in my environment.

ltx0633 avatar Nov 22 '23 03:11 ltx0633

any news here? getting the same but for me it seems random. Im not being able to constantly reproduce..

orengriffin avatar Apr 04 '24 09:04 orengriffin

这里有什么消息吗? 得到相同的但对我来说这似乎是随机的。我无法不断重现..

Unfortunately, no one is dealing with this problem. As I answered earlier, it could be a tar module problem, but I couldn't fix it, and then I used buildkit and so far everything looks fine (https://github.com/moby/buildkit)

ltx0633 avatar Apr 10 '24 03:04 ltx0633

any update on this?

suyog1pathak avatar Aug 06 '24 12:08 suyog1pathak

Any update? Facing the same issue.

DeyanPeshev avatar Aug 13 '24 12:08 DeyanPeshev

My workaround is to use the --single-snapshot parameter. Then I don't have the problem. Not sure about the implications for caching of intermediate layers, but is not relevant for me.

hborchardt avatar Aug 14 '24 10:08 hborchardt

The previous solution didn't work for me. Any other suggestions?

alaajamal-git avatar Apr 01 '25 18:04 alaajamal-git