This repository was archived by the owner on Jun 3, 2025. It is now read-only.
Description Disclaimer: i don't know if that's a bug in kaniko or docker, but as kaniko tries to mirror the docker build experience i file the issue here
Actual behavior
Kaniko copies link to layer, so it doesn't have the target file in the layer
Expected behavior
Like docker, copy the content of the links target.
Additional information
vebis@docker-builder:~/kaniko-links$ docker --version
Docker version 19.03.0, build aeac9490dc
vebis@docker-builder:~/kaniko-links$ ls -la
total 16
drwxr-xr-x 2 vebis vebis 4096 Jan 21 08:08 .
drwxr-xr-x 45 vebis vebis 4096 Jan 21 08:08 ..
-rw-r--r-- 1 vebis vebis 5 Jan 21 08:02 actual_file
-rw-r--r-- 1 vebis vebis 145 Jan 21 08:08 Dockerfile
lrwxrwxrwx 1 vebis vebis 11 Jan 21 08:02 link_to_file -> actual_file
vebis@docker-builder:~/kaniko-links$ cat Dockerfile
FROM debian:buster
COPY link_to_file /tmp/link_to_file
RUN ls -la /tmp \
&& cat /tmp/link_to_file \
&& rm /tmp/link_to_file
vebis@docker-builder:~/kaniko-links$ docker build --no-cache .
Sending build context to Docker daemon 3.584kB
Step 1/3 : FROM debian:buster
---> a6b611f7ad8f
Step 2/3 : COPY link_to_file /tmp/link_to_file
---> 1306f140a05e
Step 3/3 : RUN ls -la /tmp && cat /tmp/link_to_file && rm /tmp/link_to_file
---> Running in 7f2ca2fdf3b1
total 12
drwxrwxrwt 1 root root 4096 Jan 21 07:08 .
drwxr-xr-x 1 root root 4096 Jan 21 07:08 ..
-rw-r--r-- 1 root root 5 Jan 21 07:02 link_to_file
test
Removing intermediate container 7f2ca2fdf3b1
---> 541d5a599f1b
Successfully built 541d5a599f1b
vebis@docker-builder:~/kaniko-links$ docker run --rm --volume $HOME/cache:/cache --volume $HOME/.docker:/root/.docker --volume $HOME/.docker:/kaniko/.docker --volume $PWD:/build gcr.io/kaniko-project/executor:debug-v0.16.0 --no-push --context /build --skip-tls-verify --skip-tls-verify-pull --dockerfile=Dockerfile
INFO[0000] Resolved base name debian:buster to debian:buster
INFO[0000] Resolved base name debian:buster to debian:buster
INFO[0000] Retrieving image manifest debian:buster
INFO[0008] Retrieving image manifest debian:buster
INFO[0008] Built cross stage deps: map[]
INFO[0008] Retrieving image manifest debian:buster
INFO[0008] Retrieving image manifest debian:buster
INFO[0009] Unpacking rootfs as cmd COPY link_to_file /tmp/link_to_file requires it.
INFO[0011] Taking snapshot of full filesystem...
INFO[0013] COPY link_to_file /tmp/link_to_file
INFO[0013] Taking snapshot of files...
INFO[0013] RUN ls -la /tmp && cat /tmp/link_to_file && rm /tmp/link_to_file
INFO[0013] cmd: /bin/sh
INFO[0013] args: [-c ls -la /tmp && cat /tmp/link_to_file && rm /tmp/link_to_file]
total 8
drwxrwxrwt 2 root root 4096 Jan 21 07:09 .
drwxr-xr-x 1 root root 4096 Jan 21 07:09 ..
lrwxrwxrwx 1 root root 11 Jan 21 07:09 link_to_file -> actual_file
cat: /tmp/link_to_file: No such file or directory
error building image: error building stage: failed to execute command: waiting for process to exit: exit status 1
Reactions are currently unavailable
Disclaimer: i don't know if that's a bug in kaniko or docker, but as kaniko tries to mirror the docker build experience i file the issue here
Actual behavior
Kaniko copies link to layer, so it doesn't have the target file in the layer
Expected behavior
Like docker, copy the content of the links target.
Additional information