Skip to content
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

ADD or COPY with symbolic link breaks image #942

Closed
shortstories opened this issue Jan 3, 2020 · 0 comments · Fixed by #943
Closed

ADD or COPY with symbolic link breaks image #942

shortstories opened this issue Jan 3, 2020 · 0 comments · Fixed by #943
Labels
area/dockerfile-command For all bugs related to dockerfile file commands kind/bug Something isn't working priority/p1 Basic need feature compatibility with docker build. we should be working on this next.

Comments

@shortstories
Copy link
Contributor

shortstories commented Jan 3, 2020

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

  1. 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/ 
  1. 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
  1. 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
    • See To Reproduce
  • Build Context
    • See To Reproduce
  • 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
@cvgw cvgw added kind/bug Something isn't working area/dockerfile-command For all bugs related to dockerfile file commands labels Jan 3, 2020
@cvgw cvgw added the priority/p1 Basic need feature compatibility with docker build. we should be working on this next. label Jan 10, 2020
@tejal29 tejal29 added this to the GA Release v1.0.0 milestone Jan 10, 2020
@cvgw cvgw closed this as completed in #943 Jan 21, 2020
cvgw added a commit that referenced this issue Jan 21, 2020
Fix #942 COPY or ADD to symlink destination breaks image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dockerfile-command For all bugs related to dockerfile file commands kind/bug Something isn't working priority/p1 Basic need feature compatibility with docker build. we should be working on this next.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants