This repository was archived by the owner on Jun 3, 2025. It is now read-only.
Description Actual behavior
Image is broken when there is a symbolic link at the destination when ADD or COPY
Expected behavior
build should succeed and sources should be in destination
To Reproduce
create Dockerfile
FROM ubuntu
RUN mkdir -p /root/real && ln -sf /root/real /root/symlink
# # cases
# case1: build success, but file path is wrong: `/root/root/real/test-file`
COPY test-file /root/symlink/test-file
# case2: image broken
COPY test-file /root/symlink/inner/test-file
# case3: build fail
COPY test-dir/ /root/symlink
# case4: image broken
COPY test-dir/ /root/symlink/test-dir/
# case5: image broken
COPY test-dir/ /root/symlink/inner/test-dir/
image build with kaniko
$ mkdir test-dir && echo " test" > test-file && cp test-file test-dir/test-dir-file
$ /kaniko/executor --destination=shortstories/kaniko-test:case1 -v=trace
docker run
$ docker run --rm -it --entrypoint=' /bin/bash' shortstories/kaniko-test:case4
Unable to find image ' shortstories/kaniko-test:case4' locally
test: Pulling from shortstories/kaniko-test
2746a4a261c9: Pull complete
4c1d20cdee96: Pull complete
0d3160e1d0de: Pull complete
c8e37668deea: Pull complete
ad9c552434bd: Pull complete
780db71f2ce6: Extracting [==================================================> ] 257B/257B
docker: failed to register layer: Error processing tar file(exit status 1): mkdir /root/symlink: file exists.
See ' docker run --help' .
test images
shortstories/kaniko-test:case1
shortstories/kaniko-test:case2
shortstories/kaniko-test:case4
shortstories/kaniko-test:case5
Additional Information
Dockerfile
Build Context
Kaniko Image (fully qualified with digest)
gcr.io/kaniko-project/executor:v0.15.0 (digest: sha256:630f263d9123266b9f5420d9bc130e6a79306dbc312e5a7d35d922df391192bb)
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
Reactions are currently unavailable
Actual behavior
Image is broken when there is a symbolic link at the destination when ADD or COPY
Expected behavior
build should succeed and sources should be in destination
To Reproduce
shortstories/kaniko-test:case1shortstories/kaniko-test:case2shortstories/kaniko-test:case4shortstories/kaniko-test:case5Additional Information
To ReproduceTo Reproducegcr.io/kaniko-project/executor:v0.15.0(digest:sha256:630f263d9123266b9f5420d9bc130e6a79306dbc312e5a7d35d922df391192bb)Triage Notes for the Maintainers
--cacheflag