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
Saving file . for later use fails #1487
Comments
See also: #960 |
Did you figure out how to solve this? I'm having the same issue. |
I think I realized it is by design. Kaniko is not able to copy filesystem root over stages. I think it is in documentation. Although the error/feedback could use improvement. |
I have a similar issue with the latest
Is there an option how to work around this issue? |
We have the same issue here |
Hello, I have similar issue as @puppetmaster mentioned above. Please advise. |
I solved this for my use case in the Dockerfile. FROM python:3.11-slim as base
# Setup env
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1
FROM base AS python-deps
ENV VIRTUAL_ENV=/opt/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY ./requirements* ./
...
FROM base AS runtime
ENV APP_USER=appuser
# ENV VIRTUAL_ENV has been taken from the above stage
# ENV PATH has been taken from the above stage
...
COPY --from=python-deps $VIRTUAL_ENV $VIRTUAL_ENV
... Thus, the effective COPY has been executed from In Kaniko I got the error described before, because $VIRTUAL_ENV has not been initialized in stage
Here is the resulting essential part of the Dockerfile that fixed it: FROM python:3.11-slim as base
# Setup env
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1
FROM base AS python-deps
ENV VIRTUAL_ENV=/opt/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY ./requirements* ./
...
FROM base AS runtime
ENV APP_USER=appuser
ENV VIRTUAL_ENV=/opt/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
...
COPY --from=python-deps $VIRTUAL_ENV $VIRTUAL_ENV
... Thus, even if everybody here has a different use case, the common hint might be to prevent copying the root filesystem from one stage to another, because there is a lot of files in /dev, /proc etc. which just can't be copied by Docker COPY from one OS to another one. For me it was easy to find out, but for somebody else it might be trickier. |
@rkrell - I cannot believe I just stumbled upon this. You actually fixed my exact issue I was having where I had an |
Actually, to make kaniko to be consistent with Docker: I'm not sure whether native dockerd supports it by mistake or by definition - in case the scope of Although the initially reported Dockerfile in this issue doesn't show this clearly and maybe the issue there is a different one. It looks like the path |
Actual behavior
Expected behavior
This should simply work as the same Dockerfile used with
docker
works.To Reproduce
Running with gitlab-runner 13.3.2
Using Kubernetes executor with image gcr.io/kaniko-project/executor:debug-v1.2.0 ...
Steps to reproduce the behavior:
/kaniko/executor --cache=true --reproducible --context=$CI_PROJECT_DIR --dockerfile=$CI_PROJECT_DIR/Dockerfile --destination=$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --cache-repo=$CI_REGISTRY_IMAGE/cache --snapshotMode=redo
Additional Information
Triage Notes for the Maintainers
--cache
flagThe text was updated successfully, but these errors were encountered: