Execution takes too long for "Unpacking rootfs as cmd COPY"
Actual behavior Creating a custom kaniko image on k8s using the following Dockerfile when execute "Unpacking rootfs as cmd COPY" takes too long:
Dockerfile:
FROM python:3.8
WORKDIR /app
COPY ./main.py ./main.py
COPY ./requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
CMD python main.py
It took nearly 10 minutes at "Unpacking rootfs as cmd COPY ./main.py ./main.py requires it.":
……
[2024-04-27T16:52:37Z] Building stage 'python:3.8' [idx: '0', base-idx: '-1']
[2024-04-27T16:52:37Z] Unpacking rootfs as cmd COPY ./main.py ./main.py requires it.
[2024-04-27T17:02:07Z] WORKDIR /app
[2024-04-27T17:02:07Z] Cmd: workdir
[2024-04-27T17:02:07Z] Changed working directory to /app
……
Expected behavior should be executed quickly
Additional Information
- Build Context
--dockerfile=/kaniko/buildcontext/Dockerfile --context=<git_url> --destination=<dockerhub> --log-timestamp=true --skip-tls-verify - Kaniko Image (bitnami/kaniko:1.22.0)
Triage Notes for the Maintainers
| Description | Yes/No |
|---|---|
| Please check if this a new feature you are proposing | no |
| 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 |
no |
| Please check if your dockerfile is a multistage dockerfile | no |
Thanks for filing this @zhouya2010. Would you mind elaborating the time took with docker since it is checked off Please check if the build works in docker but not in kaniko
@JeromeJu see #1373
similar issue # 1087
In my case, when add file to .dockerignore, if the Dockerfile use this file, it would cause the COPY to get stuck.
For example, when a makefile accidentally appears in the .dockerignore file and make is used in the Dockerfile.