Actual behavior
Since v0.18.0, COPY tries to resolve some symlinks it shouldn't try to resolve, which is a regression.
Expected behavior
I would expect kaniko to let those symlinks remain symlinks when copied in the image.
To Reproduce
For instance, we can create a symlink that points to nothing to make kaniko crash:
mkdir example
cd example/
echo "FROM alpine\nCOPY . /example" > Dockerfile
ln -s ./missing symlink
docker run --rm -it -v $(pwd):/workspace:ro gcr.io/kaniko-project/executor:debug --no-push
👇 👇 👇
[…]
error building image: error building stage: failed to execute command: lstat /workspace/missing: no such file or directory
If we create the symlink target, it builds successfully but the symlink is replaced with a plain file within the image:
touch missing
docker run --rm -it -v $(pwd):/workspace:ro --entrypoint='' gcr.io/kaniko-project/executor:debug /busybox/sh -c '/kaniko/executor --no-push && ls -l /example/'
👇 👇 👇
[…]
total 4
-rw-r--r-- 1 1000 1000 29 Mar 6 14:28 Dockerfile
-rw-r--r-- 1 1000 1000 0 Mar 6 14:28 missing
-rw-r--r-- 1 1000 1000 0 Mar 6 14:28 symlink
Whereas in v0.17.1 (or using docker build) the symlink is not resolved:
$ docker run --rm -it -v $(pwd):/workspace:ro --entrypoint='' gcr.io/kaniko-project/executor:debug-v0.17.1 /busybox/sh -c '/kaniko/executor --no-push && ls -l /example/'
[…]
total 8
-rw-r--r-- 1 1000 1000 29 Mar 6 14:29 Dockerfile
-rw-r--r-- 1 1000 1000 0 Mar 6 14:29 missing
lrwxrwxrwx 1 root root 9 Mar 6 14:29 symlink -> ./missing
Additional Information
This is a regression from v0.18.0. It worked properly in v0.17.1.
Note that Kaniko v0.18.0 changed the way symlinks work to better match actual Docker's behavior. That probably introduced this bug as a side-effect.
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
Since v0.18.0,
COPYtries to resolve some symlinks it shouldn't try to resolve, which is a regression.Expected behavior
I would expect kaniko to let those symlinks remain symlinks when copied in the image.
To Reproduce
For instance, we can create a symlink that points to nothing to make kaniko crash:
👇 👇 👇
If we create the symlink target, it builds successfully but the symlink is replaced with a plain file within the image:
👇 👇 👇
Whereas in v0.17.1 (or using
docker build) the symlink is not resolved:Additional Information
This is a regression from v0.18.0. It worked properly in v0.17.1.
Note that Kaniko v0.18.0 changed the way symlinks work to better match actual Docker's behavior. That probably introduced this bug as a side-effect.
Triage Notes for the Maintainers
--cacheflag