-
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
Symlink file from a symlink directory not being copied across stages compared with docker build #1036
Comments
I ran into this issue as well but only one of my symlinks was causing an issue but not the other 30+ symlinks. I haven't dug deeper into it yet. |
Minor addendum to my prior comment: sometimes the symlink causes an issue during unpacking and other times the symlink is just... missing. |
Thanks @tanguydelignieresaccenture. I just merged #1030 which should fix this issue. |
Thanks @tejal29 , let me know. |
@tejal29, FYI, I've tested with the $ docker run --rm --entrypoint "" -v /host/path/to/dockerfile/directory/kaniko/1036:/workspace gcr.io/kaniko-project/executor:debug-e0b913997f07dab0cc5751a7b2d26f62d9c9830e /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[0002] Retrieving image manifest busybox
INFO[0004] Retrieving image manifest busybox
INFO[0005] Retrieving image manifest busybox
INFO[0007] Built cross stage deps: map[0:[/test/link]]
INFO[0007] Retrieving image manifest busybox
INFO[0009] Retrieving image manifest busybox
INFO[0010] Unpacking rootfs as cmd RUN echo "hello" > /tmp/target requires it.
INFO[0012] Taking snapshot of full filesystem...
INFO[0012] RUN echo "hello" > /tmp/target
INFO[0012] cmd: /bin/sh
INFO[0012] args: [-c echo "hello" > /tmp/target]
INFO[0012] Taking snapshot of full filesystem...
INFO[0012] RUN ln -s /tmp /test && ln -s /test/target /test/link
INFO[0012] cmd: /bin/sh
INFO[0012] args: [-c ln -s /tmp /test && ln -s /test/target /test/link]
INFO[0012] Taking snapshot of full filesystem...
INFO[0012] Saving file /tmp/target for later use
INFO[0012] Saving file /test/link for later use
INFO[0012] Deleting filesystem...
INFO[0012] Retrieving image manifest busybox
INFO[0014] Retrieving image manifest busybox
INFO[0016] Unpacking rootfs as cmd COPY --from=t /test/link /anotherplace/link requires it.
INFO[0017] Taking snapshot of full filesystem...
INFO[0017] COPY --from=t /test/link /anotherplace/link
INFO[0017] Taking snapshot of files...
INFO[0017] RUN ls -lh / && ls -lh /anotherplace/ && cat /anotherplace/link
INFO[0017] cmd: /bin/sh
INFO[0017] args: [-c ls -lh / && ls -lh /anotherplace/ && cat /anotherplace/link]
total 56K
drwxr-xr-x 2 root root 4.0K Feb 9 22:43 anotherplace
drwxr-xr-x 2 root root 12.0K Feb 9 22:43 bin
drwxr-xr-x 2 root root 12.0K Feb 9 22:43 busybox
drwxr-xr-x 5 root root 340 Feb 9 22:43 dev
drwxr-xr-x 1 root root 4.0K Feb 9 22:43 etc
drwxr-xr-x 2 nobody nogroup 4.0K Feb 9 22:43 home
drwxr-xr-x 1 root root 4.0K Feb 9 22:43 kaniko
dr-xr-xr-x 127 root root 0 Feb 9 22:43 proc
drwx------ 2 root root 4.0K Feb 9 22:43 root
dr-xr-xr-x 13 root root 0 Feb 9 22:43 sys
drwxrwxrwt 2 root root 4.0K Feb 9 22:43 tmp
drwxr-xr-x 3 root root 4.0K Feb 9 22:43 usr
drwxr-xr-x 4 root root 4.0K Feb 9 22:43 var
drwxrwxrwx 1 root root 0 Feb 7 13:53 workspace
total 4K
-rw-r--r-- 1 root root 6 Feb 9 22:43 link
hello
INFO[0017] Taking snapshot of full filesystem...
INFO[0018] No files were changed, appending empty layer to config. No layer added to image.
INFO[0018] Skipping push to container registry due to --no-push flag Dockerfile used: 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
RUN ls -lh / && \
ls -lh /anotherplace/ && \
cat /anotherplace/link |
I just verified your dockerfile in latest master
I checked the built image:
|
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.
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
The text was updated successfully, but these errors were encountered: