Actual behavior
A clear and concise description of what the bug is.
For docker build, copy symlink file from a symlink directory copy the actual file across stages.
For kaniko build, copy symlink file from a symlink directory throws the following error across stages:
error building image: error building stage: failed to execute command: failed to get fileinfo for /kaniko/0/test/link: lstat /kaniko/0/test/link: no such file or directory
Expected behavior
A clear and concise description of what you expected to happen.
For kaniko build, copy symlink file from a symlink directory would copy the actual file across stages, as in docker build.
To Reproduce
Steps to reproduce the behavior:
-
Use the provided Dockerfile
-
Run kaniko build
Additional Information
Please provide either the Dockerfile you're trying to build or one that can reproduce this error.
FROM busybox as t
RUN echo "hello" > /tmp/target
RUN ln -s /tmp /test && \
ln -s /test/target /test/link
FROM busybox
COPY --from=t /test/link /anotherplace/link
Please provide or clearly describe any files needed to build the Dockerfile (ADD/COPY commands)
Nothing more than the provided Dockerfile.
- Kaniko Image (fully qualified with digest)
gcr.io/kaniko-project/executor:debug-v0.17.1
- Kaniko build command line and result
$ docker run --rm --entrypoint "" -v /host/path/to/dockerfile/directory:/workspace gcr.io/kaniko-project/executor:debug-v0.17.1 /kaniko/executor --context /workspace --dockerfile /workspace/Dockerfile --no-push
INFO[0000] Resolved base name busybox to busybox
INFO[0000] Resolved base name busybox to busybox
INFO[0000] Resolved base name busybox to busybox
INFO[0000] Resolved base name busybox to busybox
INFO[0000] Retrieving image manifest busybox
INFO[0001] Retrieving image manifest busybox
INFO[0003] Retrieving image manifest busybox
INFO[0004] Retrieving image manifest busybox
INFO[0005] Built cross stage deps: map[0:[/test/link]]
INFO[0005] Retrieving image manifest busybox
INFO[0006] Retrieving image manifest busybox
INFO[0007] Unpacking rootfs as cmd RUN echo "hello" > /tmp/target requires it.
INFO[0008] Taking snapshot of full filesystem...
INFO[0008] RUN echo "hello" > /tmp/target
INFO[0008] cmd: /bin/sh
INFO[0008] args: [-c echo "hello" > /tmp/target]
INFO[0008] Taking snapshot of full filesystem...
INFO[0008] RUN ln -s /tmp /test && ln -s /test/target /test/link
INFO[0008] cmd: /bin/sh
INFO[0008] args: [-c ln -s /tmp /test && ln -s /test/target /test/link]
INFO[0008] Taking snapshot of full filesystem...
INFO[0008] Saving file /tmp/target for later use
INFO[0008] Saving file /test/link for later use
INFO[0008] Deleting filesystem...
INFO[0008] Retrieving image manifest busybox
INFO[0009] Retrieving image manifest busybox
INFO[0010] Unpacking rootfs as cmd COPY --from=t /test/link /anotherplace/link requires it.
INFO[0011] Taking snapshot of full filesystem...
INFO[0011] COPY --from=t /test/link /anotherplace/link
error building image: error building stage: failed to execute command: failed to get fileinfo for /kaniko/0/test/link: lstat /kaniko/0/test/link: no such file or directory
- Docker build command line and result
$ docker build -t docker-test .
Sending build context to Docker daemon 2.048kB
Step 1/5 : FROM busybox as t
---> 6d5fcfe5ff17
Step 2/5 : RUN echo "hello" > /tmp/target
---> Using cache
---> 9735661d6942
Step 3/5 : RUN ln -s /tmp /test && ln -s /test/target /test/link
---> Using cache
---> 90bea1a8c973
Step 4/5 : FROM busybox
---> 6d5fcfe5ff17
Step 5/5 : COPY --from=t /test/link /anotherplace/link
---> 58cf0c1cbb36
Successfully built 58cf0c1cbb36
Successfully tagged docker-test:latest
$ docker run --rm -ti docker-test sh
/ # ls -lh /
total 40K
drwxr-xr-x 2 root root 4.0K Feb 5 10:32 anotherplace
drwxr-xr-x 2 root root 12.0K Dec 23 19:21 bin
drwxr-xr-x 5 root root 360 Feb 5 10:34 dev
drwxr-xr-x 1 root root 4.0K Feb 5 10:34 etc
drwxr-xr-x 2 nobody nogroup 4.0K Dec 23 19:21 home
dr-xr-xr-x 191 root root 0 Feb 5 10:34 proc
drwx------ 1 root root 4.0K Feb 5 10:34 root
dr-xr-xr-x 13 root root 0 Feb 5 10:34 sys
drwxrwxrwt 2 root root 4.0K Dec 23 19:21 tmp
drwxr-xr-x 3 root root 4.0K Dec 23 19:21 usr
drwxr-xr-x 4 root root 4.0K Dec 23 19:21 var
/ # ls -lh /anotherplace/
total 4K
-rw-r--r-- 1 root root 6 Feb 5 10:30 link
/ # cat /anotherplace/link
hello
/ #
The use case is having a symlinked directory with a symlinked file in the stage 0 image, and needing to extract the actual target to the base image of the multistage build.
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 |
|
| Please check if this error is seen when you use --cache flag |
|
| Please check if your dockerfile is a multistage dockerfile |
|
Actual behavior
A clear and concise description of what the bug is.
For docker build, copy symlink file from a symlink directory copy the actual file across stages.
For kaniko build, copy symlink file from a symlink directory throws the following error across stages:
error building image: error building stage: failed to execute command: failed to get fileinfo for /kaniko/0/test/link: lstat /kaniko/0/test/link: no such file or directoryExpected behavior
A clear and concise description of what you expected to happen.
For kaniko build, copy symlink file from a symlink directory would copy the actual file across stages, as in docker build.
To Reproduce
Steps to reproduce the behavior:
Use the provided Dockerfile
Run kaniko build
Additional Information
Please provide either the Dockerfile you're trying to build or one that can reproduce this error.
Please provide or clearly describe any files needed to build the Dockerfile (ADD/COPY commands)
Nothing more than the provided Dockerfile.
gcr.io/kaniko-project/executor:debug-v0.17.1
The use case is having a symlinked directory with a symlinked file in the stage 0 image, and needing to extract the actual target to the base image of the multistage build.
Triage Notes for the Maintainers