-
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
Multi-Stage Image builds are failing at Stage 0 as the filesystem is being deleted. #2509
Comments
can someone pls help me with a workaround/fix for this. |
@Srinivask9000 Could you please provide a minimal failing example and specific error message? Deleting filesystem is a normal behavior and not a problem. I was able to build a project using latest run.sh
Pipfile +
|
@sumkincpp Thanks for looking into this. As I mentioned in the initial bug report, I'm facing this issue only while building the Image in Jenkins Agent not on local machine. As you mentioned in your comment - it is working in my local to with docker run:
But this kaniko build is failing only in Jenkins Agent, as it is deleting the core workspace for Jenkins which is needed to continue the multistage build(while using multistage dockerfile). I'm initiating the build in jenkins using below script:
I am attaching the console log screenshot for your reference. Pls let me know if you need any other details from my side. |
Kaniko does not work with plain call of /kaniko/executor on a VM - a whole empty root filesystem layout should be available for it at start, then for every stage kaniko will try reusing it, then when necessary emptying it, unpacking files, preparing them for the next stage, etc. You should probably try using docker build agents or kubernetes in jenkins, both providing empty sandboxed environment (Container), but not directly running it in your jenkins node (VM) PS. In Kubernetes Jenkins plugin you should probably change default workdir to /tmp/jenkins https://docs.cloudbees.com/docs/cloudbees-ci-kb/latest/cloudbees-ci-on-modern-cloud-platforms/what-you-need-to-know-when-using-kaniko-from-kubernetes-jenkins-agents |
@sumkincpp I'm doing the same plain call of /kaniko/executor for building a few other images, the build & deployment The reason why I'm using Jenkins-Agent is: I'm setting up Jenkins on ECS Fargate & building Images on ECS Fargate Jenkins Agent containers. And I finally got it working after using the flag "--ignore-path=" - which moved the jenkins workspace into out of the snapshot scope & proceeded to the next step. I think It is mandatory to use --ignore-path for building multistage images on the Fargate Jenkins agent. |
I believe this is resolved now from the above. As mentioned, when kaniko "cleans up" either via the |
Cool, it has bored me for almost a year. |
Brutal. |
@Srinivask9000 hi, i have same setup and same issue with you. But I coulnd't understand the use of --ignore-path. Can you explain a little bit more use of --ignore-path in the project ? Or which path ? |
Kaniko fails to store the multistage image at stage 0 - as it works fine with traditional docker files. After setting "--verbosity debug"
I found that it is deleting the entire file system on the Jenkins-Agent.
Dockerfile
`
FROM ubuntu:20.04 AS base
ENV PYTHONUNBUFFERED 1
COPY Pipfile.lock /app/
RUN apt-get update &&
apt-get install --no-install-recommends -y python3 python-is-python3 pipenv gnupg &&
pip install --no-cache-dir --upgrade pip &&
apt-get autoremove -y &&
apt-get clean -y
COPY . /app
WORKDIR /app
FROM base AS dev
RUN apt-get install --no-install-recommends -y vim git &&
pipenv install --system --deploy --dev &&
python manage.py collectstatic --noinput -c
FROM base AS production
RUN pipenv install python-crontab &&
pipenv install --system --deploy &&
python manage.py collectstatic --noinput -c
`
To Reproduce
Steps to reproduce the behavior:
/kaniko/executor --context /home/jenkins/workspace/Kaniko-Image-Build-DL/Test-Image-Build/dataloader --dockerfile /home/jenkins/workspace/Kaniko-Image-Build-DL/Test-Image-Build/dataloader/Dockerfile --destination ********/kanikobuild:latest '--target=dev' --skip-tls-verify --verbosity debug
Additional Information
--cache
flagThe text was updated successfully, but these errors were encountered: